Re: [PATCH v3 1/3] dyndbg: make dyndbg a known cli param

From: jim . cromie
Date: Wed Sep 22 2021 - 14:23:50 EST


On Mon, Sep 20, 2021 at 2:55 PM Andrew Halaney <ahalaney@xxxxxxxxxx> wrote:
>
> Right now dyndbg shows up as an unknown parameter if used on boot:
>
> Unknown command line parameters: dyndbg=+p
>
> That's because it is unknown, it doesn't sit in the __param
> section, so the processing done to warn users supplying an unknown
> parameter doesn't think it is legitimate.
>
> Install a dummy handler to register it. dynamic debug needs to search
> the whole command line for modules listed that are currently builtin,
> so there's no real work to be done in this callback.
>
> Fixes: 86d1919a4fb0 ("init: print out unknown kernel parameters")
> Signed-off-by: Andrew Halaney <ahalaney@xxxxxxxxxx>


I just validated that this does NOT block or short circuit bare
dyndbg= processing,

[ 0.981166] dyndbg: dyndbg="+fl"
[ 0.981281] dyndbg: query 0: "+fl"
[ 0.981836] dyndbg: split into words: "+fl"
[ 0.982281] dyndbg: op='+'
[ 0.982861] dyndbg: flags=0xc
[ 0.983281] dyndbg: *flagsp=0xc *maskp=0xffffffff
[ 0.984044] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0
[ 0.984298] dyndbg: changed arch/x86/pci/irq.c:1312
[irq]pcibios_fixup_irqs =fl
[ 0.985284] dyndbg: changed arch/x86/pci/irq.c:1259
[irq]pcibios_lookup_irq =fl
[ 0.986281] dyndbg: changed arch/x86/pci/irq.c:1229
[irq]pcibios_lookup_irq =fl

you have my T-B

> ---
> lib/dynamic_debug.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index cb5abb42c16a..84c16309cc63 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -761,6 +761,18 @@ static __init int ddebug_setup_query(char *str)
>
> __setup("ddebug_query=", ddebug_setup_query);
>
> +/*
> + * Install a noop handler to make dyndbg look like a normal kernel cli param.
> + * This avoids warnings about dyndbg being an unknown cli param when supplied
> + * by a user.
> + */
> +static __init int dyndbg_setup(char *str)
> +{
> + return 1;
> +}
> +
> +__setup("dyndbg=", dyndbg_setup);
> +
> /*
> * File_ops->write method for <debugfs>/dynamic_debug/control. Gathers the
> * command text from userspace, parses and executes it.
> --
> 2.31.1
>