* Re: Boot Warning [not found] <CAHbf0-G4bmpuXorwH-e_chWm1fXX7AJ8ck5AL4p+AFevhvdBfg@mail.gmail.com> @ 2024-07-22 15:23 ` Borislav Petkov 2024-07-22 16:56 ` Mike Lothian 0 siblings, 1 reply; 5+ messages in thread From: Borislav Petkov @ 2024-07-22 15:23 UTC (permalink / raw) To: Mike Lothian; +Cc: x86-ml, lkml On Mon, Jul 22, 2024 at 01:45:35PM +0100, Mike Lothian wrote: > Hi > > I'm seeing the following boot warning: > > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 0 at arch/x86/lib/cmdline.c:211 > cmdline_find_option_bool+0x741/0x760 > Modules linked in: > CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.10.0-tip+ #4105 > RIP: 0010:cmdline_find_option_bool+0x741/0x760 > Code: 85 07 f9 ff ff eb 20 41 80 f8 21 72 1c 45 31 c9 41 80 f8 21 41 > 0f 93 c1 45 01 c9 81 f9 00 08 00 00 0f 85 e5 f8 ff ff 31 c0 c3 <0f> 0b > 48 85 ff 0f 85 ce f8 ff ff b8 ff ff ff ff c3 cc cc cc cc cc > RSP: 0000:ffffffff83803f18 EFLAGS: 00010046 ORIG_RAX: 0000000000000000 > RAX: 000000000a50000c RBX: 0000000068747541 RCX: ffffffff833f2bec > RDX: 0000000000000000 RSI: ffffffff832def4e RDI: ffffffff83b98820 > RBP: 0000000000a50f00 R08: 00cf9a000000ffff R09: 0000000000000030 > R10: 000000006c617470 R11: 0000000000100000 R12: 0000000000000000 > R13: 0000000000000000 R14: 00000000b53e4000 R15: 00000000b53e4000 > FS: 0000000000000000(0000) GS:ffffffff83acd000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: ffff8880b61c6810 CR3: 0000000004b57000 CR4: 00000000000000b0 > Call Trace: > <TASK> > ? __warn+0xcb/0x1c0 > ? cmdline_find_option_bool+0x741/0x760 > ? report_bug+0x173/0x220 > ? early_fixup_exception+0x4a/0xa0 > ? early_idt_handler_common+0x2f/0x40 > ? cmdline_find_option_bool+0x741/0x760 > ? check_loader_disabled_bsp+0x46/0xa0 > ? load_ucode_bsp+0x6b/0x80 > ? x86_64_start_kernel+0x4b/0x70 > ? common_startup_64+0x12c/0x137 > </TASK> > ---[ end trace 0000000000000000 ]--- > > I use an efi stub kernel > https://github.com/FireBurn/KernelStuff/blob/master/dot_config_tip > > I wasn't quite sure where to report this in the bugzilla, I'll happily > raise one if you let me know which section it should be in Yeah, you can usually CC x86@ and lkml and that is fine too - bugzilla is not absolutely required. Did that now. Anyway, yeah, this is nasty. Our handling of the merging of the builtin and boot cmdline options would need some serious reshuffling to fix this: the ucode loader needs to parse cmdline but the final cmdline is built a lot later. The only easy thing I could think of right now is, well, to check both cmdline strings before the merging happens. Something like the completely untested below: --- arch/x86/include/asm/cmdline.h | 4 ++++ arch/x86/kernel/setup.c | 2 +- arch/x86/lib/cmdline.c | 27 ++++++++++++++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/cmdline.h b/arch/x86/include/asm/cmdline.h index 6faaf27e8899..abcb270e2a07 100644 --- a/arch/x86/include/asm/cmdline.h +++ b/arch/x86/include/asm/cmdline.h @@ -2,6 +2,10 @@ #ifndef _ASM_X86_CMDLINE_H #define _ASM_X86_CMDLINE_H +#include <asm/setup.h> + +extern char __initdata builtin_cmdline[COMMAND_LINE_SIZE]; + int cmdline_find_option_bool(const char *cmdline_ptr, const char *option); int cmdline_find_option(const char *cmdline_ptr, const char *option, char *buffer, int bufsize); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 5d34cad9b7b1..6129dc2ba784 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -164,7 +164,7 @@ unsigned long saved_video_mode; static char __initdata command_line[COMMAND_LINE_SIZE]; #ifdef CONFIG_CMDLINE_BOOL -static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; +char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; bool builtin_cmdline_added __ro_after_init; #endif diff --git a/arch/x86/lib/cmdline.c b/arch/x86/lib/cmdline.c index 384da1fdd5c6..75e7e2cc4569 100644 --- a/arch/x86/lib/cmdline.c +++ b/arch/x86/lib/cmdline.c @@ -207,18 +207,31 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size, int cmdline_find_option_bool(const char *cmdline, const char *option) { - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) - WARN_ON_ONCE(!builtin_cmdline_added); + int ret; - return __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); + ret = __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); + if (ret > 0) + return ret; + +#ifdef CONFIG_CMDLINE_BOOL + if (!builtin_cmdline_added) + ret = __cmdline_find_option_bool(builtin_cmdline, COMMAND_LINE_SIZE, option); +#endif + return ret; } int cmdline_find_option(const char *cmdline, const char *option, char *buffer, int bufsize) { - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) - WARN_ON_ONCE(!builtin_cmdline_added); + int ret; + + ret = __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); + if (ret > 0) + return ret; - return __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, - buffer, bufsize); +#ifdef CONFIG_CMDLINE_BOOL + if (!builtin_cmdline_added) + ret = __cmdline_find_option(builtin_cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); +#endif + return ret; } -- 2.43.0 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Boot Warning 2024-07-22 15:23 ` Boot Warning Borislav Petkov @ 2024-07-22 16:56 ` Mike Lothian 2024-07-30 15:21 ` [PATCH] x86/setup: Parse the builtin command line before merging Borislav Petkov 0 siblings, 1 reply; 5+ messages in thread From: Mike Lothian @ 2024-07-22 16:56 UTC (permalink / raw) To: Borislav Petkov; +Cc: x86-ml, lkml That patch does indeed make the warning go away :D Is there anything else you need from me? On Mon, 22 Jul 2024 at 16:23, Borislav Petkov <bp@alien8.de> wrote: > > On Mon, Jul 22, 2024 at 01:45:35PM +0100, Mike Lothian wrote: > > Hi > > > > I'm seeing the following boot warning: > > > > ------------[ cut here ]------------ > > WARNING: CPU: 0 PID: 0 at arch/x86/lib/cmdline.c:211 > > cmdline_find_option_bool+0x741/0x760 > > Modules linked in: > > CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.10.0-tip+ #4105 > > RIP: 0010:cmdline_find_option_bool+0x741/0x760 > > Code: 85 07 f9 ff ff eb 20 41 80 f8 21 72 1c 45 31 c9 41 80 f8 21 41 > > 0f 93 c1 45 01 c9 81 f9 00 08 00 00 0f 85 e5 f8 ff ff 31 c0 c3 <0f> 0b > > 48 85 ff 0f 85 ce f8 ff ff b8 ff ff ff ff c3 cc cc cc cc cc > > RSP: 0000:ffffffff83803f18 EFLAGS: 00010046 ORIG_RAX: 0000000000000000 > > RAX: 000000000a50000c RBX: 0000000068747541 RCX: ffffffff833f2bec > > RDX: 0000000000000000 RSI: ffffffff832def4e RDI: ffffffff83b98820 > > RBP: 0000000000a50f00 R08: 00cf9a000000ffff R09: 0000000000000030 > > R10: 000000006c617470 R11: 0000000000100000 R12: 0000000000000000 > > R13: 0000000000000000 R14: 00000000b53e4000 R15: 00000000b53e4000 > > FS: 0000000000000000(0000) GS:ffffffff83acd000(0000) knlGS:0000000000000000 > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > > CR2: ffff8880b61c6810 CR3: 0000000004b57000 CR4: 00000000000000b0 > > Call Trace: > > <TASK> > > ? __warn+0xcb/0x1c0 > > ? cmdline_find_option_bool+0x741/0x760 > > ? report_bug+0x173/0x220 > > ? early_fixup_exception+0x4a/0xa0 > > ? early_idt_handler_common+0x2f/0x40 > > ? cmdline_find_option_bool+0x741/0x760 > > ? check_loader_disabled_bsp+0x46/0xa0 > > ? load_ucode_bsp+0x6b/0x80 > > ? x86_64_start_kernel+0x4b/0x70 > > ? common_startup_64+0x12c/0x137 > > </TASK> > > ---[ end trace 0000000000000000 ]--- > > > > I use an efi stub kernel > > https://github.com/FireBurn/KernelStuff/blob/master/dot_config_tip > > > > I wasn't quite sure where to report this in the bugzilla, I'll happily > > raise one if you let me know which section it should be in > > Yeah, you can usually CC x86@ and lkml and that is fine too - bugzilla is not > absolutely required. Did that now. > > Anyway, yeah, this is nasty. Our handling of the merging of the builtin and > boot cmdline options would need some serious reshuffling to fix this: the > ucode loader needs to parse cmdline but the final cmdline is built a lot > later. > > The only easy thing I could think of right now is, well, to check both cmdline > strings before the merging happens. > > Something like the completely untested below: > > --- > arch/x86/include/asm/cmdline.h | 4 ++++ > arch/x86/kernel/setup.c | 2 +- > arch/x86/lib/cmdline.c | 27 ++++++++++++++++++++------- > 3 files changed, 25 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/include/asm/cmdline.h b/arch/x86/include/asm/cmdline.h > index 6faaf27e8899..abcb270e2a07 100644 > --- a/arch/x86/include/asm/cmdline.h > +++ b/arch/x86/include/asm/cmdline.h > @@ -2,6 +2,10 @@ > #ifndef _ASM_X86_CMDLINE_H > #define _ASM_X86_CMDLINE_H > > +#include <asm/setup.h> > + > +extern char __initdata builtin_cmdline[COMMAND_LINE_SIZE]; > + > int cmdline_find_option_bool(const char *cmdline_ptr, const char *option); > int cmdline_find_option(const char *cmdline_ptr, const char *option, > char *buffer, int bufsize); > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index 5d34cad9b7b1..6129dc2ba784 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -164,7 +164,7 @@ unsigned long saved_video_mode; > > static char __initdata command_line[COMMAND_LINE_SIZE]; > #ifdef CONFIG_CMDLINE_BOOL > -static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; > +char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; > bool builtin_cmdline_added __ro_after_init; > #endif > > diff --git a/arch/x86/lib/cmdline.c b/arch/x86/lib/cmdline.c > index 384da1fdd5c6..75e7e2cc4569 100644 > --- a/arch/x86/lib/cmdline.c > +++ b/arch/x86/lib/cmdline.c > @@ -207,18 +207,31 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size, > > int cmdline_find_option_bool(const char *cmdline, const char *option) > { > - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) > - WARN_ON_ONCE(!builtin_cmdline_added); > + int ret; > > - return __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); > + ret = __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); > + if (ret > 0) > + return ret; > + > +#ifdef CONFIG_CMDLINE_BOOL > + if (!builtin_cmdline_added) > + ret = __cmdline_find_option_bool(builtin_cmdline, COMMAND_LINE_SIZE, option); > +#endif > + return ret; > } > > int cmdline_find_option(const char *cmdline, const char *option, char *buffer, > int bufsize) > { > - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) > - WARN_ON_ONCE(!builtin_cmdline_added); > + int ret; > + > + ret = __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); > + if (ret > 0) > + return ret; > > - return __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, > - buffer, bufsize); > +#ifdef CONFIG_CMDLINE_BOOL > + if (!builtin_cmdline_added) > + ret = __cmdline_find_option(builtin_cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); > +#endif > + return ret; > } > -- > 2.43.0 > > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] x86/setup: Parse the builtin command line before merging 2024-07-22 16:56 ` Mike Lothian @ 2024-07-30 15:21 ` Borislav Petkov 2024-07-31 13:31 ` Thomas Gleixner 2024-07-31 19:50 ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov (AMD) 0 siblings, 2 replies; 5+ messages in thread From: Borislav Petkov @ 2024-07-30 15:21 UTC (permalink / raw) To: Mike Lothian; +Cc: x86-ml, lkml On Mon, Jul 22, 2024 at 05:56:08PM +0100, Mike Lothian wrote: > That patch does indeed make the warning go away :D > > Is there anything else you need from me? Nah, all good. Thanks for reporting and testing. From: "Borislav Petkov (AMD)" <bp@alien8.de> Date: Tue, 30 Jul 2024 16:15:12 +0200 Subject: [PATCH] x86/setup: Parse the builtin command line before merging Commit in Fixes was added as a catch-all for cases where the cmdline is parsed before being merged with the builtin one. And promptly one issue appeared, see Link below. And the microcode loader really needs to parse it that early. And the merging happens late. Reshuffling the early boot nightmare^W code to handle that properly would be a painful exercise for another day so do the chicken thing and parse the builtin cmdline too before it has been merged. Fixes: 0c40b1c7a897 ("x86/setup: Warn when option parsing is done too early") Reported-by: Mike Lothian <mike@fireburn.co.uk> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240722152330.GCZp55ck8E_FT4kPnC@fat_crate.local --- arch/x86/include/asm/cmdline.h | 4 ++++ arch/x86/kernel/setup.c | 2 +- arch/x86/lib/cmdline.c | 29 ++++++++++++++++++++++------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/cmdline.h b/arch/x86/include/asm/cmdline.h index 6faaf27e8899..6cbd9ae58b21 100644 --- a/arch/x86/include/asm/cmdline.h +++ b/arch/x86/include/asm/cmdline.h @@ -2,6 +2,10 @@ #ifndef _ASM_X86_CMDLINE_H #define _ASM_X86_CMDLINE_H +#include <asm/setup.h> + +extern char builtin_cmdline[COMMAND_LINE_SIZE]; + int cmdline_find_option_bool(const char *cmdline_ptr, const char *option); int cmdline_find_option(const char *cmdline_ptr, const char *option, char *buffer, int bufsize); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 5d34cad9b7b1..6129dc2ba784 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -164,7 +164,7 @@ unsigned long saved_video_mode; static char __initdata command_line[COMMAND_LINE_SIZE]; #ifdef CONFIG_CMDLINE_BOOL -static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; +char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; bool builtin_cmdline_added __ro_after_init; #endif diff --git a/arch/x86/lib/cmdline.c b/arch/x86/lib/cmdline.c index 384da1fdd5c6..c51726c251a0 100644 --- a/arch/x86/lib/cmdline.c +++ b/arch/x86/lib/cmdline.c @@ -207,18 +207,33 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size, int cmdline_find_option_bool(const char *cmdline, const char *option) { - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) - WARN_ON_ONCE(!builtin_cmdline_added); + int ret; - return __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); + ret = __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); + if (ret > 0) + return ret; + + if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) { + if (!builtin_cmdline_added) + return __cmdline_find_option_bool(builtin_cmdline, COMMAND_LINE_SIZE, option); + } + + return ret; } int cmdline_find_option(const char *cmdline, const char *option, char *buffer, int bufsize) { - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) - WARN_ON_ONCE(!builtin_cmdline_added); + int ret; + + ret = __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); + if (ret > 0) + return ret; + + if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) { + if (!builtin_cmdline_added) + return __cmdline_find_option(builtin_cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); + } - return __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, - buffer, bufsize); + return ret; } -- 2.43.0 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/setup: Parse the builtin command line before merging 2024-07-30 15:21 ` [PATCH] x86/setup: Parse the builtin command line before merging Borislav Petkov @ 2024-07-31 13:31 ` Thomas Gleixner 2024-07-31 19:50 ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov (AMD) 1 sibling, 0 replies; 5+ messages in thread From: Thomas Gleixner @ 2024-07-31 13:31 UTC (permalink / raw) To: Borislav Petkov, Mike Lothian; +Cc: x86-ml, lkml On Tue, Jul 30 2024 at 17:21, Borislav Petkov wrote: > On Mon, Jul 22, 2024 at 05:56:08PM +0100, Mike Lothian wrote: >> That patch does indeed make the warning go away :D >> >> Is there anything else you need from me? > > Nah, all good. > > Thanks for reporting and testing. > > From: "Borislav Petkov (AMD)" <bp@alien8.de> > Date: Tue, 30 Jul 2024 16:15:12 +0200 > Subject: [PATCH] x86/setup: Parse the builtin command line before merging > > Commit in Fixes was added as a catch-all for cases where the cmdline is > parsed before being merged with the builtin one. > > And promptly one issue appeared, see Link below. And the microcode > loader really needs to parse it that early. And the merging happens > late. Reshuffling the early boot nightmare^W code to handle that > properly would be a painful exercise for another day so do the chicken > thing and parse the builtin cmdline too before it has been merged. > > Fixes: 0c40b1c7a897 ("x86/setup: Warn when option parsing is done too early") > Reported-by: Mike Lothian <mike@fireburn.co.uk> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> > Link: https://lore.kernel.org/r/20240722152330.GCZp55ck8E_FT4kPnC@fat_crate.local Reviewed-by: Thomas Gleixner <tglx@linutronix.de> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: x86/urgent] x86/setup: Parse the builtin command line before merging 2024-07-30 15:21 ` [PATCH] x86/setup: Parse the builtin command line before merging Borislav Petkov 2024-07-31 13:31 ` Thomas Gleixner @ 2024-07-31 19:50 ` tip-bot2 for Borislav Petkov (AMD) 1 sibling, 0 replies; 5+ messages in thread From: tip-bot2 for Borislav Petkov (AMD) @ 2024-07-31 19:50 UTC (permalink / raw) To: linux-tip-commits Cc: Mike Lothian, Borislav Petkov (AMD), Thomas Gleixner, x86, linux-kernel The following commit has been merged into the x86/urgent branch of tip: Commit-ID: bf514327c324bc8af64f359b341cc9b189c096fd Gitweb: https://git.kernel.org/tip/bf514327c324bc8af64f359b341cc9b189c096fd Author: Borislav Petkov (AMD) <bp@alien8.de> AuthorDate: Tue, 30 Jul 2024 16:15:12 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Wed, 31 Jul 2024 21:46:35 +02:00 x86/setup: Parse the builtin command line before merging Commit in Fixes was added as a catch-all for cases where the cmdline is parsed before being merged with the builtin one. And promptly one issue appeared, see Link below. The microcode loader really needs to parse it that early, but the merging happens later. Reshuffling the early boot nightmare^W code to handle that properly would be a painful exercise for another day so do the chicken thing and parse the builtin cmdline too before it has been merged. Fixes: 0c40b1c7a897 ("x86/setup: Warn when option parsing is done too early") Reported-by: Mike Lothian <mike@fireburn.co.uk> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240730152108.GAZqkE5Dfi9AuKllRw@fat_crate.local Link: https://lore.kernel.org/r/20240722152330.GCZp55ck8E_FT4kPnC@fat_crate.local --- arch/x86/include/asm/cmdline.h | 4 ++++ arch/x86/kernel/setup.c | 2 +- arch/x86/lib/cmdline.c | 25 ++++++++++++++++++------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/cmdline.h b/arch/x86/include/asm/cmdline.h index 6faaf27..6cbd9ae 100644 --- a/arch/x86/include/asm/cmdline.h +++ b/arch/x86/include/asm/cmdline.h @@ -2,6 +2,10 @@ #ifndef _ASM_X86_CMDLINE_H #define _ASM_X86_CMDLINE_H +#include <asm/setup.h> + +extern char builtin_cmdline[COMMAND_LINE_SIZE]; + int cmdline_find_option_bool(const char *cmdline_ptr, const char *option); int cmdline_find_option(const char *cmdline_ptr, const char *option, char *buffer, int bufsize); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 5d34cad..6129dc2 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -164,7 +164,7 @@ unsigned long saved_video_mode; static char __initdata command_line[COMMAND_LINE_SIZE]; #ifdef CONFIG_CMDLINE_BOOL -static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; +char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; bool builtin_cmdline_added __ro_after_init; #endif diff --git a/arch/x86/lib/cmdline.c b/arch/x86/lib/cmdline.c index 384da1f..c65cd55 100644 --- a/arch/x86/lib/cmdline.c +++ b/arch/x86/lib/cmdline.c @@ -207,18 +207,29 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size, int cmdline_find_option_bool(const char *cmdline, const char *option) { - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) - WARN_ON_ONCE(!builtin_cmdline_added); + int ret; - return __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); + ret = __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); + if (ret > 0) + return ret; + + if (IS_ENABLED(CONFIG_CMDLINE_BOOL) && !builtin_cmdline_added) + return __cmdline_find_option_bool(builtin_cmdline, COMMAND_LINE_SIZE, option); + + return ret; } int cmdline_find_option(const char *cmdline, const char *option, char *buffer, int bufsize) { - if (IS_ENABLED(CONFIG_CMDLINE_BOOL)) - WARN_ON_ONCE(!builtin_cmdline_added); + int ret; + + ret = __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); + if (ret > 0) + return ret; + + if (IS_ENABLED(CONFIG_CMDLINE_BOOL) && !builtin_cmdline_added) + return __cmdline_find_option(builtin_cmdline, COMMAND_LINE_SIZE, option, buffer, bufsize); - return __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, - buffer, bufsize); + return ret; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-31 19:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAHbf0-G4bmpuXorwH-e_chWm1fXX7AJ8ck5AL4p+AFevhvdBfg@mail.gmail.com>
2024-07-22 15:23 ` Boot Warning Borislav Petkov
2024-07-22 16:56 ` Mike Lothian
2024-07-30 15:21 ` [PATCH] x86/setup: Parse the builtin command line before merging Borislav Petkov
2024-07-31 13:31 ` Thomas Gleixner
2024-07-31 19:50 ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov (AMD)
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox