Re: linux-next: build warning after merge of the rcu tree

From: Paul E. McKenney
Date: Tue Jul 25 2023 - 23:48:19 EST


On Tue, Jul 25, 2023 at 08:33:06PM -0700, Paul E. McKenney wrote:
> On Wed, Jul 26, 2023 at 12:32:30PM +1000, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the rcu tree, today's linux-next build (x86_64 allmodconfig)
> > produced this warning:
> >
> > WARNING: modpost: vmlinux: section mismatch in reference: cmdline_load_proc_show+0x22 (section: .text) -> boot_command_line (section: .init.data)
> >
> > Introduced by commit
> >
> > cf9eca90a339 ("fs/proc: Add /proc/cmdline_load for boot loader arguments")
>
> That __initdata needs to be __ro_after_init, doesn't it? Will fix,
> thank you!

Sigh. Hit "send" too soon. :-/

Does the following incremental diff (to be squashed into the original) help?

Thanx, Paul

------------------------------------------------------------------------

diff --git a/init/main.c b/init/main.c
index c946ab87783a..981170da0b1c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(system_state);
void (*__initdata late_time_init)(void);

/* Untouched command line saved by arch-specific code. */
-char __initdata boot_command_line[COMMAND_LINE_SIZE];
+char boot_command_line[COMMAND_LINE_SIZE] __ro_after_init;
/* Untouched saved command line (eg. for /proc) */
char *saved_command_line __ro_after_init;
unsigned int saved_command_line_len __ro_after_init;