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

From: Borislav Petkov
Date: Wed May 05 2021 - 10:20:56 EST


On Tue, May 04, 2021 at 10:26:14AM -0500, Andrew Halaney wrote:
> Definitely a matter of opinion, but with the kernel having specific
> ways to denote init destined parameters (anything after "--") I think
> an unconditional message is acceptable.

Or - and I had alluded to that on IRC - you *actually* know which params
are kernel params:

#define __setup_param(str, unique_id, fn, early) \
static const char __setup_str_##unique_id[] __initconst \
__aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \
__used __section(".init.setup") \
^^^^^^^^^^^^^^^^^^

__aligned(__alignof__(struct obs_kernel_param)) \
= { __setup_str_##unique_id, fn, early }


all those guys in the above section.

So you'd have iterate over those and do some cheap version of those
autocorrect algorithms which guess which words you meant. For example,
if you have:

panik_on_oops instead of
panic_on_oops

the difference is one letter so it is likely a mistyped param rather
than something which goes to init or other random garbage and then you
warn.

Something like that.

It would need a lot of experimentation first, though, to see whether
this makes sense and it is workable at all.

Thx.

--
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg