diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 84 | ||||
-rw-r--r-- | init/main.c | 16 |
2 files changed, 76 insertions, 24 deletions
diff --git a/init/Kconfig b/init/Kconfig index f7da6c96e..a51000610 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -920,6 +920,28 @@ config LOG_CPU_MAX_BUF_SHIFT 13 => 8 KB for each CPU 12 => 4 KB for each CPU +config NMI_LOG_BUF_SHIFT + int "Temporary per-CPU NMI log buffer size (12 => 4KB, 13 => 8KB)" + range 10 21 + default 13 + depends on PRINTK_NMI + help + Select the size of a per-CPU buffer where NMI messages are temporary + stored. They are copied to the main log buffer in a safe context + to avoid a deadlock. The value defines the size as a power of 2. + + NMI messages are rare and limited. The largest one is when + a backtrace is printed. It usually fits into 4KB. Select + 8KB if you want to be on the safe side. + + Examples: + 17 => 128 KB for each CPU + 16 => 64 KB for each CPU + 15 => 32 KB for each CPU + 14 => 16 KB for each CPU + 13 => 8 KB for each CPU + 12 => 4 KB for each CPU + # # Architectures with an unreliable sched_clock() should select this: # @@ -1347,33 +1369,30 @@ source "usr/Kconfig" endif choice - prompt "Code optimization level" - default CC_OPTIMIZE_DEFAULT - help - Select the optimization flag to pass to the compiler, - affecting kernel size, speed and compilation time. - - If in doubt, choose the default optimization level. + prompt "Compiler optimization level" + default CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE -config CC_OPTIMIZE_DEFAULT - bool "Default optimization" +config CC_OPTIMIZE_FOR_PERFORMANCE + bool "Optimize for performance" help - This option will pass "-O2" to your compiler. This is - the recommended level and the most tested. + This is the default optimization level for the kernel, building + with the "-O2" compiler flag for best performance and most + helpful compile-time warnings. config CC_OPTIMIZE_HARDER bool "Optimize harder" help - This option will pass "-O3" to your compiler resulting - in a larger and faster kernel. The more complex - optimizations also increase compilation time and may - affect stability. + This option will pass "-O3" to your compiler resulting in a + larger and faster kernel. The more complex optimizations also + increase compilation time and may affect stability. config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size" help - This option will pass "-Os" to your compiler resulting - in a smaller kernel. + Enabling this option will pass "-Os" instead of "-O2" to + your compiler resulting in a smaller kernel. + + If unsure, say N. endchoice @@ -1508,6 +1527,7 @@ config KALLSYMS_ALL config KALLSYMS_ABSOLUTE_PERCPU bool + depends on KALLSYMS default X86_64 && SMP config KALLSYMS_BASE_RELATIVE @@ -1539,6 +1559,11 @@ config PRINTK very difficult to diagnose system problems, saying N here is strongly discouraged. +config PRINTK_NMI + def_bool y + depends on PRINTK + depends on HAVE_NMI + config BUG bool "BUG() support" if EXPERT default y @@ -1828,6 +1853,15 @@ config SLOB endchoice +config SLAB_FREELIST_RANDOM + default n + depends on SLAB + bool "SLAB freelist randomization" + help + Randomizes the freelist order used on creating new SLABs. This + security feature reduces the predictability of the kernel slab + allocator against heap overflows. + config SLUB_CPU_PARTIAL default y depends on SLUB && SMP @@ -2099,6 +2133,22 @@ config MODULE_COMPRESS_XZ endchoice +config TRIM_UNUSED_KSYMS + bool "Trim unused exported kernel symbols" + depends on MODULES && !UNUSED_SYMBOLS + help + The kernel and some modules make many symbols available for + other modules to use via EXPORT_SYMBOL() and variants. Depending + on the set of modules being selected in your kernel configuration, + many of those exported symbols might never be used. + + This option allows for unused exported symbols to be dropped from + the build. In turn, this provides the compiler more opportunities + (especially when using LTO) for optimizing the code and reducing + binary size. This might have some security advantages as well. + + If unsure say N. + endif # MODULES config MODULES_TREE_LOOKUP diff --git a/init/main.c b/init/main.c index 31f9f4da5..0d6addf19 100644 --- a/init/main.c +++ b/init/main.c @@ -453,7 +453,7 @@ void __init __weak smp_setup_processor_id(void) } # if THREAD_SIZE >= PAGE_SIZE -void __init __weak thread_info_cache_init(void) +void __init __weak thread_stack_cache_init(void) { } #endif @@ -569,6 +569,7 @@ asmlinkage __visible void __init start_kernel(void) timekeeping_init(); time_init(); sched_clock_postinit(); + printk_nmi_init(); perf_event_init(); profile_init(); call_function_init(); @@ -626,7 +627,7 @@ asmlinkage __visible void __init start_kernel(void) /* Should be run before the first non-init thread is created */ init_espfix_bsp(); #endif - thread_info_cache_init(); + thread_stack_cache_init(); cred_init(); fork_init(); proc_caches_init(); @@ -706,21 +707,22 @@ static int __init initcall_blacklist(char *str) static bool __init_or_module initcall_blacklisted(initcall_t fn) { struct blacklist_entry *entry; - char *fn_name; + char fn_name[KSYM_SYMBOL_LEN]; + unsigned long addr; - fn_name = kasprintf(GFP_KERNEL, "%pf", fn); - if (!fn_name) + if (list_empty(&blacklisted_initcalls)) return false; + addr = (unsigned long) dereference_function_descriptor(fn); + sprint_symbol_no_offset(fn_name, addr); + 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); return true; } } - kfree(fn_name); return false; } #else |