lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230726143348.724611-1-arnd@kernel.org>
Date:   Wed, 26 Jul 2023 16:33:21 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     "Paul E. McKenney" <paulmck@...nel.org>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        "ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] init: keep boot_command_line after init

From: Arnd Bergmann <arnd@...db.de>

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)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Change it to __ro_after_init to prevent it from getting freed.

Fixes: cf9eca90a3397 ("fs/proc: Add /proc/cmdline_load for boot loader arguments")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 include/linux/init.h | 2 +-
 init/main.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/init.h b/include/linux/init.h
index 9a5973324072b..4e97a7a29a4d7 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -143,7 +143,7 @@ struct file_system_type;
 
 /* Defined in init/main.c */
 extern int do_one_initcall(initcall_t fn);
-extern char __initdata boot_command_line[];
+extern char boot_command_line[];
 extern char *saved_command_line;
 extern unsigned int saved_command_line_len;
 extern unsigned int reset_devices;
diff --git a/init/main.c b/init/main.c
index c946ab87783a1..981170da0b1cd 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;
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ