aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig74
-rw-r--r--init/initramfs.c11
-rw-r--r--init/main.c105
3 files changed, 27 insertions, 163 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 1fb5f313d18f0f..32c24950c4ced9 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -765,30 +765,6 @@ config LOG_CPU_MAX_BUF_SHIFT
13 => 8 KB for each CPU
12 => 4 KB for each CPU
-config PRINTK_SAFE_LOG_BUF_SHIFT
- int "Temporary per-CPU printk log buffer size (12 => 4KB, 13 => 8KB)"
- range 10 21
- default 13
- depends on PRINTK
- help
- Select the size of an alternate printk per-CPU buffer where messages
- printed from unsafe contexts are temporary stored. One example would
- be NMI messages, another one - printk recursion. The messages 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.
-
- Those 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
-
config PRINTK_INDEX
bool "Printk indexing debugfs interface"
depends on PRINTK && DEBUG_FS
@@ -890,18 +866,14 @@ config CC_IMPLICIT_FALLTHROUGH
default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)
-# Currently, disable gcc-11,12 array-bounds globally.
-# We may want to target only particular configurations some day.
+# Currently, disable gcc-11+ array-bounds globally.
+# It's still broken in gcc-13, so no upper bound yet.
config GCC11_NO_ARRAY_BOUNDS
def_bool y
-config GCC12_NO_ARRAY_BOUNDS
- def_bool y
-
config CC_NO_ARRAY_BOUNDS
bool
- default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_ARRAY_BOUNDS
- default y if CC_IS_GCC && GCC_VERSION >= 120000 && GCC_VERSION < 130000 && GCC12_NO_ARRAY_BOUNDS
+ default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS
#
# For architectures that know their GCC __int128 support is sound
@@ -973,7 +945,7 @@ config MEMCG
config MEMCG_KMEM
bool
- depends on MEMCG && !SLOB
+ depends on MEMCG
default y
config BLK_CGROUP
@@ -1297,44 +1269,6 @@ config SCHED_AUTOGROUP
desktop applications. Task group autogeneration is currently based
upon task session.
-config SYSFS_DEPRECATED
- bool "Enable deprecated sysfs features to support old userspace tools"
- depends on SYSFS
- default n
- help
- This option adds code that switches the layout of the "block" class
- devices, to not show up in /sys/class/block/, but only in
- /sys/block/.
-
- This switch is only active when the sysfs.deprecated=1 boot option is
- passed or the SYSFS_DEPRECATED_V2 option is set.
-
- This option allows new kernels to run on old distributions and tools,
- which might get confused by /sys/class/block/. Since 2007/2008 all
- major distributions and tools handle this just fine.
-
- Recent distributions and userspace tools after 2009/2010 depend on
- the existence of /sys/class/block/, and will not work with this
- option enabled.
-
- Only if you are using a new kernel on an old distribution, you might
- need to say Y here.
-
-config SYSFS_DEPRECATED_V2
- bool "Enable deprecated sysfs features by default"
- default n
- depends on SYSFS
- depends on SYSFS_DEPRECATED
- help
- Enable deprecated sysfs by default.
-
- See the CONFIG_SYSFS_DEPRECATED option for more details about this
- option.
-
- Only if you are using a new kernel on an old distribution, you might
- need to say Y here. Even then, odds are you would not need it
- enabled, you can always pass the boot option if absolutely necessary.
-
config RELAY
bool "Kernel->user space relay support (formerly relayfs)"
select IRQ_WORK
diff --git a/init/initramfs.c b/init/initramfs.c
index f6c112e30bd47d..e7a01c2ccd1b0c 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -60,15 +60,8 @@ static void __init error(char *x)
message = x;
}
-static void panic_show_mem(const char *fmt, ...)
-{
- va_list args;
-
- show_mem(0, NULL);
- va_start(args, fmt);
- panic(fmt, args);
- va_end(args);
-}
+#define panic_show_mem(fmt, ...) \
+ ({ show_mem(0, NULL); panic(fmt, ##__VA_ARGS__); })
/* link hash */
diff --git a/init/main.c b/init/main.c
index 65aab4e9bb49cf..af50044deed567 100644
--- a/init/main.c
+++ b/init/main.c
@@ -62,7 +62,6 @@
#include <linux/rmap.h>
#include <linux/mempolicy.h>
#include <linux/key.h>
-#include <linux/page_ext.h>
#include <linux/debug_locks.h>
#include <linux/debugobjects.h>
#include <linux/lockdep.h>
@@ -156,7 +155,7 @@ static char *extra_init_args;
#ifdef CONFIG_BOOT_CONFIG
/* Is bootconfig on command line? */
-static bool bootconfig_found = IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE);
+static bool bootconfig_found;
static size_t initargs_offs;
#else
# define bootconfig_found false
@@ -429,7 +428,7 @@ static void __init setup_boot_config(void)
err = parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
bootconfig_params);
- if (IS_ERR(err) || !bootconfig_found)
+ if (IS_ERR(err) || !(bootconfig_found || IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE)))
return;
/* parse_args() stops at the next param of '--' and returns an address */
@@ -437,7 +436,11 @@ static void __init setup_boot_config(void)
initargs_offs = err - tmp_cmdline;
if (!data) {
- pr_err("'bootconfig' found on command line, but no bootconfig found\n");
+ /* If user intended to use bootconfig, show an error level message */
+ if (bootconfig_found)
+ pr_err("'bootconfig' found on command line, but no bootconfig found\n");
+ else
+ pr_info("No bootconfig data provided, so skipping bootconfig");
return;
}
@@ -707,7 +710,7 @@ noinline void __ref __noreturn rest_init(void)
rcu_read_unlock();
numa_default_policy();
- pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
+ pid = kernel_thread(kthreadd, NULL, NULL, CLONE_FS | CLONE_FILES);
rcu_read_lock();
kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
rcu_read_unlock();
@@ -803,69 +806,6 @@ static inline void initcall_debug_enable(void)
}
#endif
-/* Report memory auto-initialization states for this boot. */
-static void __init report_meminit(void)
-{
- const char *stack;
-
- if (IS_ENABLED(CONFIG_INIT_STACK_ALL_PATTERN))
- stack = "all(pattern)";
- else if (IS_ENABLED(CONFIG_INIT_STACK_ALL_ZERO))
- stack = "all(zero)";
- else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL))
- stack = "byref_all(zero)";
- else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF))
- stack = "byref(zero)";
- else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_USER))
- stack = "__user(zero)";
- else
- stack = "off";
-
- pr_info("mem auto-init: stack:%s, heap alloc:%s, heap free:%s\n",
- stack, want_init_on_alloc(GFP_KERNEL) ? "on" : "off",
- want_init_on_free() ? "on" : "off");
- if (want_init_on_free())
- pr_info("mem auto-init: clearing system memory may take some time...\n");
-}
-
-/*
- * Set up kernel memory allocators
- */
-static void __init mm_init(void)
-{
- /*
- * page_ext requires contiguous pages,
- * bigger than MAX_ORDER unless SPARSEMEM.
- */
- page_ext_init_flatmem();
- init_mem_debugging_and_hardening();
- kfence_alloc_pool();
- report_meminit();
- kmsan_init_shadow();
- stack_depot_early_init();
- mem_init();
- mem_init_print_info();
- kmem_cache_init();
- /*
- * page_owner must be initialized after buddy is ready, and also after
- * slab is ready so that stack_depot_init() works properly
- */
- page_ext_init_flatmem_late();
- kmemleak_init();
- pgtable_init();
- debug_objects_mem_init();
- vmalloc_init();
- /* If no deferred init page_ext now, as vmap is fully initialized */
- if (!deferred_struct_pages)
- page_ext_init();
- /* Should be run before the first non-init thread is created */
- init_espfix_bsp();
- /* Should be run after espfix64 is set up. */
- pti_init();
- kmsan_init_runtime();
- mm_cache_init();
-}
-
#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
DEFINE_STATIC_KEY_MAYBE_RO(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT,
randomize_kstack_offset);
@@ -968,9 +908,6 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
boot_cpu_hotplug_init();
- build_all_zonelists(NULL);
- page_alloc_init();
-
pr_notice("Kernel command line: %s\n", saved_command_line);
/* parameters may set static keys */
jump_label_init();
@@ -992,13 +929,13 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
/*
* These use large bootmem allocations and must precede
- * kmem_cache_init()
+ * initalization of page allocator
*/
setup_log_buf(0);
vfs_caches_init_early();
sort_main_extable();
trap_init();
- mm_init();
+ mm_core_init();
poking_init();
ftrace_init();
@@ -1088,14 +1025,6 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
*/
locking_selftest();
- /*
- * This needs to be called before any devices perform DMA
- * operations that might use the SWIOTLB bounce buffers. It will
- * mark the bounce buffers as decrypted so that their usage will
- * not cause "plain-text" data to be decrypted when accessed.
- */
- mem_encrypt_init();
-
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start && !initrd_below_start_ok &&
page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
@@ -1112,6 +1041,17 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
late_time_init();
sched_clock_init();
calibrate_delay();
+
+ /*
+ * This needs to be called before any devices perform DMA
+ * operations that might use the SWIOTLB bounce buffers. It will
+ * mark the bounce buffers as decrypted so that their usage will
+ * not cause "plain-text" data to be decrypted when accessed. It
+ * must be called after late_time_init() so that Hyper-V x86/x64
+ * hypercalls work when the SWIOTLB bounce buffers are decrypted.
+ */
+ mem_encrypt_init();
+
pid_idr_init();
anon_vma_init();
#ifdef CONFIG_X86
@@ -1627,9 +1567,6 @@ static noinline void __init kernel_init_freeable(void)
padata_init();
page_alloc_init_late();
- /* Initialize page ext after all struct pages are initialized. */
- if (deferred_struct_pages)
- page_ext_init();
do_basic_setup();