Skip to content

[PW_SID:1148125] init, arch: make command line size and init arg limit configurable - #2488

Closed
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw1148125
Closed

[PW_SID:1148125] init, arch: make command line size and init arg limit configurable#2488
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw1148125

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1148125 applied to workflow__riscv__fixes

Name: init, arch: make command line size and init arg limit configurable
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1148125
Version: 2

ThreeBottleCap and others added 5 commits August 14, 2026 14:12
…_RWX

When CONFIG_STRICT_MODULE_RWX is not set, execmem cannot create
temporary writable mappings for read-only executable pages. In this
case, the execmem ranges must already have writable permissions.

Currently EXECMEM_KPROBES unconditionally uses PAGE_KERNEL_READ_EXEC,
which causes kprobe instruction slot writes to trigger page faults
on systems where CONFIG_STRICT_MODULE_RWX is not enabled.

Fix this by using PAGE_KERNEL_EXEC when CONFIG_STRICT_MODULE_RWX
is not available.

Signed-off-by: Xiaofeng Yuan <xiaofengmian@163.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://patch.msgid.link/20260814082742.148403-2-xiaofengmian@163.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
patch_map() always creates a temporary writable mapping via fixmap for
kernel text addresses, even when CONFIG_STRICT_KERNEL_RWX is disabled
and the kernel text is already mapped with _PAGE_WRITE.

This is unnecessary overhead at best, and on minimal configurations
it can cause page faults.

Skip the fixmap path for kernel text when CONFIG_STRICT_KERNEL_RWX
is not enabled, since the text pages are already writable in that case.
The module text path is already gated on CONFIG_STRICT_MODULE_RWX and
is kept unchanged.

Reported-by: Klara Modin <klara@kasm.eu>
Closes: https://lore.kernel.org/all/ant_8TaBbov_GS4i@soda.int.kasm.eu/
Reported-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Closes: https://lore.kernel.org/all/CA+V-a8tQK8rih9SGGTyqrEBGpNkx4H0eX2YccCRrgkVAPr+EBg@mail.gmail.com/
Tested-by: Klara Modin <klarasmodin@gmail.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20260814082742.148403-3-xiaofengmian@163.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Currently, s390 has the ability to configure the maximum kernel command
line size via Kconfig (CONFIG_COMMAND_LINE_SIZE). Other architectures
define a hardcoded COMMAND_LINE_SIZE macro in their setup.h headers.

In some use cases, such as netboot kernels, rootfs configurations, or
larger initramfs setups, a larger command line size is required. While
for embedded workloads, it can be reduced to save memory.

Move CONFIG_COMMAND_LINE_SIZE out of arch/s390/Kconfig and into
init/Kconfig under General setup, and update every architecture's setup.h
header to define COMMAND_LINE_SIZE as CONFIG_COMMAND_LINE_SIZE.

For user-space API (uapi) headers, wrap the definition in an
`#ifdef __KERNEL__` guard and retain the historical hardcoded default in
the `#else` block. When user-space headers are installed via
`make headers_install`, unifdef strips out the kernel section, ensuring
the same value as before for user-space applications including
`<asm/setup.h>`.

For S390, the range is kept the same, but other architectures have varying
constraints. S390 requires a minimum of 896 bytes to protect legacy
bootloaders from overwriting the .text section. ARM, M68K, and NIOS2
allocate the command line directly on severely constrained decompressor
stacks, so their ranges are strictly capped at 2048 bytes to prevent
deterministic stack exhaustion and boot panics. PowerPC (PPC) boot
wrappers silently truncate arguments past 2048 bytes, so it is also
capped at 2048 to prevent silent parameter loss.

The SuperH (SUPERH) boot parameter page allocates exactly PAGE_SIZE
(typically 4096 bytes), and placing a 4096-byte command line starting
at offset 256 would cause strscpy() to read out of bounds; it is
capped at 3840 bytes. Alpha physically limits its boot parameter block
to 256 bytes, so its limit is strictly locked to 256. All other
architectures are capped at 4096 bytes to prevent unreasonable
allocations.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Wilson Felipe Pereira <wfelipe@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
INIT_ENV_ARG_LIMIT is defined without a prompt string (`int`), making it
a hidden Kconfig symbol that defaults to 32 (or 128 for UML) and cannot
be configured in `make menuconfig`.

Now that CONFIG_COMMAND_LINE_SIZE is configurable across all architectures,
users who select larger kernel command lines (e.g., 4096 bytes) may pass
more than 32 command-line arguments or environment variables (`foo=bar`) to
`/sbin/init`. If INIT_ENV_ARG_LIMIT remains hardcoded at 32, any argument
after the 32nd sets the panic_later flag and causes a hard kernel panic
on boot.

Add a prompt string ("Maximum number of kernel command line arguments") and
a `range 32 4096` to `config INIT_ENV_ARG_LIMIT` so that users can
configure their init argument and environment variable limit when needed,
while preserving the existing default of 32 for standard builds.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Wilson Felipe Pereira <wfelipe@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 144.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1475.51 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1768.47 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 28.35 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 4.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 88.98 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
kdoc
Desc: Detects for kdoc errors
Duration: 0.94 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
module-param
Desc: Detect module_param changes
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v2,1/2] init, arch: make CONFIG_COMMAND_LINE_SIZE globally configurable"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 143.85 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1126.97 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1431.15 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 27.03 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.93 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.71 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 86.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
kdoc
Desc: Detects for kdoc errors
Duration: 0.97 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
module-param
Desc: Detect module_param changes
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v2,2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.33 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw1148125 branch August 26, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants