Skip to content

Commit

Permalink
x86: setup_smep needs to be __cpuinit
Browse files Browse the repository at this point in the history
The setup_smep function gets calle at resume time too, and is thus not a
pure __init function.  When marked as __init, it gets thrown out after
the kernel has initialized, and when the kernel is suspended and
resumed, the code will no longer be around, and we'll get a nice "kernel
tried to execute NX-protected page" oops because the page is no longer
marked executable.

Reported-and-tested-by: Parag Warudkar <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed May 23, 2011
1 parent a1e4891 commit 82da65d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ static inline void squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
}
#endif

static int disable_smep __initdata;
static int disable_smep __cpuinitdata;
static __init int setup_disable_smep(char *arg)
{
disable_smep = 1;
return 1;
}
__setup("nosmep", setup_disable_smep);

static __init void setup_smep(struct cpuinfo_x86 *c)
static __cpuinit void setup_smep(struct cpuinfo_x86 *c)
{
if (cpu_has(c, X86_FEATURE_SMEP)) {
if (unlikely(disable_smep)) {
Expand Down

0 comments on commit 82da65d

Please sign in to comment.