kallsyms: add support for relative offsets in kallsyms address table
[deliverable/linux.git] / init / main.c
index c6ebefafa496106fbb398656245d75f4d59f1f8d..031a60893fdbc2d52a189b428096c8e5668c7f99 100644 (file)
@@ -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'
@@ -164,10 +161,10 @@ static const char *panic_later, *panic_param;
 
 extern const struct obs_kernel_param __setup_start[], __setup_end[];
 
-static int __init obsolete_checksetup(char *line)
+static bool __init obsolete_checksetup(char *line)
 {
        const struct obs_kernel_param *p;
-       int had_early_param = 0;
+       bool had_early_param = false;
 
        p = __setup_start;
        do {
@@ -179,13 +176,13 @@ static int __init obsolete_checksetup(char *line)
                                 * Keep iterating, as we can have early
                                 * params and __setups of same names 8( */
                                if (line[n] == '\0' || line[n] == '=')
-                                       had_early_param = 1;
+                                       had_early_param = true;
                        } else if (!p->setup_func) {
                                pr_warn("Parameter %s is obsolete, ignored\n",
                                        p->str);
-                               return 1;
+                               return true;
                        } else if (p->setup_func(line + n))
-                               return 1;
+                               return true;
                }
                p++;
        } while (p < __setup_end);
@@ -499,11 +496,6 @@ asmlinkage __visible void __init start_kernel(void)
        char *command_line;
        char *after_dashes;
 
-       /*
-        * Need to run as early as possible, to initialize the
-        * lockdep hash:
-        */
-       lockdep_init();
        set_task_stack_end_magic(&init_task);
        smp_setup_processor_id();
        debug_objects_early_init();
@@ -727,7 +719,6 @@ static int __init initcall_blacklist(char *str)
 
 static bool __init_or_module initcall_blacklisted(initcall_t fn)
 {
-       struct list_head *tmp;
        struct blacklist_entry *entry;
        char *fn_name;
 
@@ -735,8 +726,7 @@ static bool __init_or_module initcall_blacklisted(initcall_t fn)
        if (!fn_name)
                return false;
 
-       list_for_each(tmp, &blacklisted_initcalls) {
-               entry = list_entry(tmp, struct blacklist_entry, next);
+       list_for_each_entry(entry, &blacklisted_initcalls, next) {
                if (!strcmp(fn_name, entry->buf)) {
                        pr_debug("initcall %s blacklisted\n", fn_name);
                        kfree(fn_name);
@@ -929,6 +919,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;
@@ -937,7 +949,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();
 
This page took 0.027009 seconds and 5 git commands to generate.