Re: [PATCH] init: keep boot_command_line after init

From: Arnd Bergmann
Date: Wed Jul 26 2023 - 13:03:29 EST


On Wed, Jul 26, 2023, at 18:25, Nick Desaulniers wrote:
> On Wed, Jul 26, 2023 at 7:33 AM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>>
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> The boot command line is not available after the init section gets discarded,
>> so adding a permanent reference to it causes a link time warning:
>>
>> WARNING: modpost: vmlinux: section mismatch in reference: cmdline_load_proc_show+0x2 (section: .text) -> boot_command_line (section: .init.data)
>
> cmdline_load_proc_show is probably inlined, but should it also be
> marked __init? It's lone call site seems to be __init AFAICT.
>

No, that's not what it does: cmdline_load_proc_show() is called
when someone reads /proc/cmdline_load from userspace. It's only
the function that creates this procfs file that is __init, but the
call happens later.

Arnd