Commit 8132672b authored by Zwane Mwaikambo's avatar Zwane Mwaikambo Committed by Linus Torvalds

[PATCH] NX: Fix noexec kernel parameter

noexec_setup runs too late to take any effect, so parse it earlier.
Signed-off-by: default avatarZwane Mwaikambo <zwane@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e376bc34
......@@ -740,6 +740,10 @@ static void __init parse_cmdline_early (char ** cmdline_p)
}
}
else if (!memcmp(from, "noexec=", 7))
noexec_setup(from + 7);
#ifdef CONFIG_X86_SMP
/*
* If the BIOS enumerates physical processors before logical,
......
......@@ -430,7 +430,7 @@ u64 __supported_pte_mask = ~_PAGE_NX;
* on Enable
* off Disable
*/
static int __init noexec_setup(char *str)
void __init noexec_setup(const char *str)
{
if (!strncmp(str, "on",2) && cpu_has_nx) {
__supported_pte_mask |= _PAGE_NX;
......@@ -439,11 +439,8 @@ static int __init noexec_setup(char *str)
disable_nx = 1;
__supported_pte_mask &= ~_PAGE_NX;
}
return 1;
}
__setup("noexec=", noexec_setup);
int nx_enabled = 0;
#ifdef CONFIG_X86_PAE
......
......@@ -318,6 +318,9 @@ static __init void parse_cmdline_early (char ** cmdline_p)
if (!memcmp(from,"oops=panic", 10))
panic_on_oops = 1;
if (!memcmp(from, "noexec=", 7))
nonx_setup(from + 7);
next_char:
c = *(from++);
if (!c)
......
......@@ -50,7 +50,7 @@ Control non executable mappings for 64bit processes.
on Enable(default)
off Disable
*/
static int __init nonx_setup(char *str)
void __init nonx_setup(const char *str)
{
if (!strcmp(str, "on")) {
__supported_pte_mask |= _PAGE_NX;
......@@ -59,11 +59,8 @@ static int __init nonx_setup(char *str)
do_not_nx = 1;
__supported_pte_mask &= ~_PAGE_NX;
}
return 1;
}
__setup("noexec=", nonx_setup);
/*
* Great future plan:
* Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
......
......@@ -357,6 +357,8 @@ extern pte_t *lookup_address(unsigned long address);
static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;}
#endif
extern void noexec_setup(const char *str);
#if defined(CONFIG_HIGHPTE)
#define pte_offset_map(dir, address) \
((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
......
......@@ -20,6 +20,7 @@ extern unsigned long __supported_pte_mask;
#define swapper_pg_dir init_level4_pgt
extern void nonx_setup(const char *str);
extern void paging_init(void);
extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment