mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] x86: stop handing boot-stage parameters to init
@ 2026-10-05 17:13 sayo
  2026-10-05 17:13 ` [PATCH v3 1/2] init: claim parameters consumed before the main kernel sayo
  2026-10-05 17:13 ` [PATCH v3 2/2] x86: claim the parameters consumed by the boot stub and decompressor sayo
  0 siblings, 2 replies; 3+ messages in thread
From: sayo @ 2026-10-05 17:13 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H . Peter Anvin
  Cc: x86, linux-kernel, m.younesbadr, nir

Some kernel parameters are consumed before the main kernel is running: the
boot stub, the decompressor and the EFI stub read the command line directly
and act on options that the main kernel never registers, because they
describe things that are already decided by then - the kernel's load
address, the paging mode, the memory encryption mode. parse_args() cannot
know they were eaten, so unknown_bootoption() hands them to init: valueless
options in argv, "key=value" ones in the environment.

On x86 that is nokaslr [KNL,EARLY], no5lvl [X86-64,RISCV,EARLY],
mem_encrypt= [X86-64] and edd= [EDD] - all documented kernel parameters.

That collides with init's own argument convention: busybox init does
"if (argv[1]) xsetenv("RUNLEVEL", argv[1]);", openrc-init takes the
runlevel from argv[1], and a shell used as init treats the argument as a
script name and exits, so a plain "nokaslr" boot reaches userspace as a
bogus RUNLEVEL.

Earlier attempts at this (2024-03, 2024-10, 2025-01) added a stub handler
for "nokaslr" alone; Boris preferred the generic version over per-parameter
stubs that only silence a warning. So patch 1 adds the hook and patch 2
fills in the x86 list. Nothing changes for parameters that are genuinely
unknown - they still reach init, and the notice names only those again.

Link: https://lore.kernel.org/all/20240331200546.869343-1-m.younesbadr@gmail.com/
Link: https://lore.kernel.org/all/20250114145521.GDZ4Z62dOwYffaUrsr@fat_crate.local/

sayo (2):
  init: claim parameters consumed before the main kernel
  x86: claim the parameters consumed by the boot stub and decompressor

 arch/x86/kernel/setup.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/linux/init.h    | 12 ++++++++++++
 init/main.c             | 16 ++++++++++++++++
 3 files changed, 68 insertions(+)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-05 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05 17:13 [PATCH v3 0/2] x86: stop handing boot-stage parameters to init sayo
2026-10-05 17:13 ` [PATCH v3 1/2] init: claim parameters consumed before the main kernel sayo
2026-10-05 17:13 ` [PATCH v3 2/2] x86: claim the parameters consumed by the boot stub and decompressor sayo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®