Skip to content

params: don't ignore the rest of cmdline if parse_one() fails

Oleg Nesterov lkml 1 version Applied

Status from this message: Applied,

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/1params: don't ignore the rest of cmdline if parse_one() failskernel/params.c+9 -81 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/1] params: don't ignore the rest of cmdline if parse_one() fails
Quoted 20 lines · Rusty Russell
Quoted 18 lines · Oleg Nesterov
Quoted 3 lines · Oleg Nesterov

I booted the kernel with the additional patch below, and nothing bad has happened,

Until I tried reboot it once with "locktorture.verbose=true" paramater. It didn't boot.

This is because parse_args() just aborts after it hits the error, so other arguments at the same initcall level are simply ignored.

Fixed by the patch below, but I simply can't believe nobody hit this (imo) bug before.

Why does parse_args() do this?? I simply can't understand why parse_args() adds more random and hard-to-understand problems if one of the args ("=true" in this particular case) is wrong.

Quoted 7 lines
Quoted 4 lines

Yes, the patch below is probably oversimplified / incomplete but imho the current behaviour is confusing. At least I was greatly confused ;) At least (I think) it makes sense to let the user know that the rest of command line was probably ignored.

This is nice, but please save and return the error properly; modules need this too.

OK, thanks, please see the patch.

Quoted 2 lines

I think nobody hit this before because they notice that they screwed up the commandline and it didn't boot.

Yes, I didn't know parse_args() works this way. Besides, I didn't notice the "invalid for parameter" error message on the serial console, so I thought that the kernel panic was somehow caused by the patch I tried to test.

Oleg.