public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/5] Parse CONFIG_CMDLINE in compressed kernel
@ 2022-11-10 13:09 Evgeniy Baskov
  2022-11-10 13:09 ` [PATCH v8 1/5] x86/boot: Add strlcat() and strscpy() to " Evgeniy Baskov
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Evgeniy Baskov @ 2022-11-10 13:09 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Evgeniy Baskov, Dave Hansen, Ingo Molnar, Thomas Gleixner,
	linux-kernel, x86, Alexey Khoroshilov

CONFIG_CMDLINE_BOOL and CONFIG_CMDLINE_OVERRIDE were ignored during
options lookup in compressed kernel, including earlyprintk option,
so it was impossible to get earlyprintk messages from that stage
of boot process via command line provided at compile time.
Being able to enable earlyprintk via compile-time option might
be desirable for booting on systems with broken UEFI command line
arguments via EFISTUB.

Changes in v2:

* Compute resulting cmdline string once if needed and then reuse it.
  Store concatenation result in a static buffer.
* Add strlcat() to compressed kernel to simplify the code.

Changes in v3:

v2 had a bug: cmd_line_ptr was set to a pointer to a buffer inside
a kernel before kernel relocation, that makes this pointer invalid.

* Replace the pointer by a boolean variable to avoid storing a pointer,
  since it becomes invalid during kernel relocation.

Changes in v4:

* Use better wording for commit messages.
* Add buffer overflow check to strlcat().
* Factor out common logic of cmdline resolving into helper function.

Changes in v5:

* Use strscpy() instead of strlcpy().

Changes in v6:

* Remove superfluous new line.
* Rename resolve_cmdline() to cmdline_prepare().
* Move shared/setup-cmdline.h to shared/cmdline.h

Changes in v7:

* Replace #ifdef with IS_ENABLED() in cmdline_prepare()
  for consistency.

Changes in v8:

* Remove the need to use special initial value for command line result
  variable and put all logic in one function to improve the clarity
  of the code.

One #ifdef is still required for the initial value of builtin cmdline
in case iti is not defined to enable the use of IS_ENABLED in
cmdline_prapare(), since it is more readable.

Evgeniy Baskov (5):
  x86/boot: Add strlcat() and strscpy() to compressed kernel
  x86: Add cmdline_prepare() helper
  x86/setup: Use cmdline_prepare() in setup.c
  x86/boot: Use cmdline_prapare() in compressed kernel
  x86/boot: Remove no longer needed includes

 arch/x86/boot/compressed/cmdline.c      | 24 +++++++++++-
 arch/x86/boot/compressed/ident_map_64.c |  4 --
 arch/x86/boot/compressed/kaslr.c        |  4 --
 arch/x86/boot/compressed/misc.h         |  1 +
 arch/x86/boot/compressed/string.c       | 50 +++++++++++++++++++++++++
 arch/x86/include/asm/shared/cmdline.h   | 35 +++++++++++++++++
 arch/x86/kernel/setup.c                 | 20 ++--------
 arch/x86/purgatory/purgatory.c          |  1 +
 8 files changed, 112 insertions(+), 27 deletions(-)
 create mode 100644 arch/x86/include/asm/shared/cmdline.h

-- 
2.37.4


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

end of thread, other threads:[~2022-11-16 11:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10 13:09 [PATCH v8 0/5] Parse CONFIG_CMDLINE in compressed kernel Evgeniy Baskov
2022-11-10 13:09 ` [PATCH v8 1/5] x86/boot: Add strlcat() and strscpy() to " Evgeniy Baskov
2022-11-10 13:09 ` [PATCH v8 2/5] x86: Add cmdline_prepare() helper Evgeniy Baskov
2022-11-14 14:28   ` Borislav Petkov
2022-11-15 18:58     ` Borislav Petkov
2022-11-15 18:59       ` [PATCH 1/2] x86/boot: Add a function for kernel command line preparation Borislav Petkov
2022-11-15 19:00       ` [PATCH 2/2] x86/boot: Use cmdline_prepare() in the compressed stage Borislav Petkov
2022-11-16 10:48         ` Evgeniy Baskov
2022-11-10 13:09 ` [PATCH v8 3/5] x86/setup: Use cmdline_prepare() in setup.c Evgeniy Baskov
2022-11-10 13:09 ` [PATCH v8 4/5] x86/boot: Use cmdline_prapare() in compressed kernel Evgeniy Baskov
2022-11-10 13:09 ` [PATCH v8 5/5] x86/boot: Remove no longer needed includes Evgeniy Baskov

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