diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-03-22 14:12:29 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-03-22 14:12:29 +0800 |
commit | 1bdc09282217939d01be67dde405880c7450c2e5 (patch) | |
tree | 635d09d42f92fe7448bcc8cdc0660dc66999e3b2 /init | |
parent | 5cc3b58828a8bb2ebb34de96d1aec1564f912a31 (diff) | |
parent | f0b92cd1190816b1293c9724488ac87e0fcc38c0 (diff) |
Merge branch 'v4.1/vdso' of https://git.linaro.org/people/david.brown/linux-lsk into linux-linaro-lsk-v4.1
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/init/main.c b/init/main.c index 2a89545e0a5d..14f36d1a081d 100644 --- a/init/main.c +++ b/init/main.c @@ -93,9 +93,6 @@ static int kernel_init(void *); extern void init_IRQ(void); extern void fork_init(void); extern void radix_tree_init(void); -#ifndef CONFIG_DEBUG_RODATA -static inline void mark_rodata_ro(void) { } -#endif /* * Debug helper: via this flag we know that we are in 'early bootup code' @@ -925,6 +922,28 @@ static int try_to_run_init_process(const char *init_filename) static noinline void __init kernel_init_freeable(void); +#ifdef CONFIG_DEBUG_RODATA +static bool rodata_enabled = true; +static int __init set_debug_rodata(char *str) +{ + return strtobool(str, &rodata_enabled); +} +__setup("rodata=", set_debug_rodata); + +static void mark_readonly(void) +{ + if (rodata_enabled) + mark_rodata_ro(); + else + pr_info("Kernel memory protection disabled.\n"); +} +#else +static inline void mark_readonly(void) +{ + pr_warn("This architecture does not have kernel memory protection.\n"); +} +#endif + static int __ref kernel_init(void *unused) { int ret; @@ -933,7 +952,7 @@ static int __ref kernel_init(void *unused) /* need to finish all async __init code before freeing the memory */ async_synchronize_full(); free_initmem(); - mark_rodata_ro(); + mark_readonly(); system_state = SYSTEM_RUNNING; numa_default_policy(); |