Re: [PATCH] init: Print out unknown kernel parameters

From: Andrew Halaney
Date: Wed May 05 2021 - 13:07:39 EST


On Wed, May 05, 2021 at 06:50:13PM +0200, Borislav Petkov wrote:
> On Wed, May 05, 2021 at 11:37:28AM -0500, Andrew Halaney wrote:
> > I actually did use that recommendation essentially, the patch I've sent
> > is riding on the work done by unknown_bootoption() which is populated by
> > iterating over over the different sections parameters can live in - so
> > this is only printing out arguments that didn't match a known kernel
> > parameter. Sorry if I didn't make that clear earlier, definitely was
> > trying to listen to your advice.
>
> Bah, don't take my "advice" too seriously - I'm just throwing out
> guesses. :-)
>
> So ok, unknown_bootoption() handles those and AFAICT, that gets passed
> to parse_args() with the __start___param and __stop___param range.
>
> But then there is that do_early_param() thing for early params, which
> are different and which are between __setup_start and __setup_end -
> i.e., the ones I meant above.
>
> And that function doesn't do the unknown bootoption handling ;-\
>
> More fun.
>
Ah, but don't worry! It is handled, just secretly:
unknown_bootoption()->obsolete_checksetup() walks __setup_start
:)

> > I'll have to think about this some more (the "did you mean this
> > parameter" part).. that seems like it might be more trouble than it is
> > worth, but I admittedly haven't looked into those cheap algorithms you
> > mentioned yet. The reason I say it might be more trouble than it is
> > worth is because it is easy to say "why didn't my param work", then grep
> > for it in dmesg and find it in the "Unknown command line parameters"
> > list - that's sort of the workflow I imagined would happen when someone
> > mucks with their kernel cli and doesn't get the intended result.
>
> Oh sure - that's what I meant with "cheap". If it can't be done
> elegantly and easily, just forget it. dmesg | grep is a lot easier. :-)
>
> Thx.
>
Still worth considering, so at least lemme ponder it for a day instead
of being lazy.

Thanks,
Andrew