x86: move nonx_setup etc from common.c to init_64.c
like 32 bit put it in init_32.c Signed-off-by: Yinghai <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
f5017cfa35
commit
bd220a24a9
|
@ -847,51 +847,6 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
|
||||||
|
|
||||||
char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss;
|
char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss;
|
||||||
|
|
||||||
unsigned long __supported_pte_mask __read_mostly = ~0UL;
|
|
||||||
EXPORT_SYMBOL_GPL(__supported_pte_mask);
|
|
||||||
|
|
||||||
static int do_not_nx __cpuinitdata;
|
|
||||||
|
|
||||||
/* noexec=on|off
|
|
||||||
Control non executable mappings for 64bit processes.
|
|
||||||
|
|
||||||
on Enable(default)
|
|
||||||
off Disable
|
|
||||||
*/
|
|
||||||
static int __init nonx_setup(char *str)
|
|
||||||
{
|
|
||||||
if (!str)
|
|
||||||
return -EINVAL;
|
|
||||||
if (!strncmp(str, "on", 2)) {
|
|
||||||
__supported_pte_mask |= _PAGE_NX;
|
|
||||||
do_not_nx = 0;
|
|
||||||
} else if (!strncmp(str, "off", 3)) {
|
|
||||||
do_not_nx = 1;
|
|
||||||
__supported_pte_mask &= ~_PAGE_NX;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
early_param("noexec", nonx_setup);
|
|
||||||
|
|
||||||
int force_personality32;
|
|
||||||
|
|
||||||
/* noexec32=on|off
|
|
||||||
Control non executable heap for 32bit processes.
|
|
||||||
To control the stack too use noexec=off
|
|
||||||
|
|
||||||
on PROT_READ does not imply PROT_EXEC for 32bit processes (default)
|
|
||||||
off PROT_READ implies PROT_EXEC
|
|
||||||
*/
|
|
||||||
static int __init nonx32_setup(char *str)
|
|
||||||
{
|
|
||||||
if (!strcmp(str, "on"))
|
|
||||||
force_personality32 &= ~READ_IMPLIES_EXEC;
|
|
||||||
else if (!strcmp(str, "off"))
|
|
||||||
force_personality32 |= READ_IMPLIES_EXEC;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
__setup("noexec32=", nonx32_setup);
|
|
||||||
|
|
||||||
void pda_init(int cpu)
|
void pda_init(int cpu)
|
||||||
{
|
{
|
||||||
struct x8664_pda *pda = cpu_pda(cpu);
|
struct x8664_pda *pda = cpu_pda(cpu);
|
||||||
|
@ -957,15 +912,6 @@ void syscall_init(void)
|
||||||
X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL);
|
X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __cpuinit check_efer(void)
|
|
||||||
{
|
|
||||||
unsigned long efer;
|
|
||||||
|
|
||||||
rdmsrl(MSR_EFER, efer);
|
|
||||||
if (!(efer & EFER_NX) || do_not_nx)
|
|
||||||
__supported_pte_mask &= ~_PAGE_NX;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long kernel_eflags;
|
unsigned long kernel_eflags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -88,6 +88,60 @@ early_param("gbpages", parse_direct_gbpages_on);
|
||||||
|
|
||||||
int after_bootmem;
|
int after_bootmem;
|
||||||
|
|
||||||
|
unsigned long __supported_pte_mask __read_mostly = ~0UL;
|
||||||
|
EXPORT_SYMBOL_GPL(__supported_pte_mask);
|
||||||
|
|
||||||
|
static int do_not_nx __cpuinitdata;
|
||||||
|
|
||||||
|
/* noexec=on|off
|
||||||
|
Control non executable mappings for 64bit processes.
|
||||||
|
|
||||||
|
on Enable(default)
|
||||||
|
off Disable
|
||||||
|
*/
|
||||||
|
static int __init nonx_setup(char *str)
|
||||||
|
{
|
||||||
|
if (!str)
|
||||||
|
return -EINVAL;
|
||||||
|
if (!strncmp(str, "on", 2)) {
|
||||||
|
__supported_pte_mask |= _PAGE_NX;
|
||||||
|
do_not_nx = 0;
|
||||||
|
} else if (!strncmp(str, "off", 3)) {
|
||||||
|
do_not_nx = 1;
|
||||||
|
__supported_pte_mask &= ~_PAGE_NX;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
early_param("noexec", nonx_setup);
|
||||||
|
|
||||||
|
void __cpuinit check_efer(void)
|
||||||
|
{
|
||||||
|
unsigned long efer;
|
||||||
|
|
||||||
|
rdmsrl(MSR_EFER, efer);
|
||||||
|
if (!(efer & EFER_NX) || do_not_nx)
|
||||||
|
__supported_pte_mask &= ~_PAGE_NX;
|
||||||
|
}
|
||||||
|
|
||||||
|
int force_personality32;
|
||||||
|
|
||||||
|
/* noexec32=on|off
|
||||||
|
Control non executable heap for 32bit processes.
|
||||||
|
To control the stack too use noexec=off
|
||||||
|
|
||||||
|
on PROT_READ does not imply PROT_EXEC for 32bit processes (default)
|
||||||
|
off PROT_READ implies PROT_EXEC
|
||||||
|
*/
|
||||||
|
static int __init nonx32_setup(char *str)
|
||||||
|
{
|
||||||
|
if (!strcmp(str, "on"))
|
||||||
|
force_personality32 &= ~READ_IMPLIES_EXEC;
|
||||||
|
else if (!strcmp(str, "off"))
|
||||||
|
force_personality32 |= READ_IMPLIES_EXEC;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
__setup("noexec32=", nonx32_setup);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: This function is marked __ref because it calls __init function
|
* NOTE: This function is marked __ref because it calls __init function
|
||||||
* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0.
|
* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0.
|
||||||
|
|
Reference in New Issue