Skip to content

init: fix array boundary bugs in boot parameter parsing

Wilson Felipe Pereira lkml 1 version Applied

Status from this message: [merged mm-nonmm-stable] init-main-fix-false-positive-kernel-panic-on-environment-variable-overwrite.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2init/main: fix off-by-one in argv_init cleanupinit/main.c+2 -20 repliesApplied
2/2init/main: fix false-positive kernel panic on environment variable overwriteinit/main.c+2 -20 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] init: fix array boundary bugs in boot parameter parsing

This series fixes two distinct boundary logic edge-case bugs in init/main.c related to parsing boot command-line arguments and environment variables. Both bugs have been present since the early git history (Linux-2.6.12-rc2).

1. The first patch fixes an off-by-one error in init_setup() where the final slot of the argv_init array was left uncleared. This allowed a stale kernel parameter to leak into the init process's user-space command line if exactly MAX_INIT_ARGS unknown parameters were passed.

2. The second patch fixes a false-positive kernel panic in unknown_bootoption(). If a user filled the environment variable array up to its exact limit (32) and then attempted to overwrite the final variable, the kernel would panic before evaluating whether it was a harmless duplicate.

Exact QEMU reproduction steps for both edge cases are documented inside their respective commit descriptions.

Wilson Felipe Pereira (2):
init/main: fix off-by-one in argv_init cleanup init/main: fix false-positive kernel panic on environment variable
overwrite

 init/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.55.0.699.gb54405d56f-goog