* [PATCH] printk: fix return value of printk.devkmsg __setup handler
@ 2022-02-28 22:05 Randy Dunlap
2022-03-01 12:58 ` John Ogness
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Randy Dunlap @ 2022-02-28 22:05 UTC (permalink / raw)
To: linux-kernel
Cc: Randy Dunlap, Igor Zhbanov, Borislav Petkov, Andrew Morton,
Petr Mladek, Sergey Senozhatsky, Steven Rostedt, John Ogness
If an invalid option value is used with "printk.devkmsg=<value>",
it is silently ignored.
If a valid option value is used, it is honored but the wrong return
value (0) is used, indicating that the command line option had an
error and was not handled. This string is not added to init's
environment strings due to init/main.c::unknown_bootoption()
checking for a '.' in the boot option string and then considering
that string to be an "Unused module parameter".
Print a warning message if a bad option string is used.
Always return 1 from the __setup handler to indicate that the command
line option has been handled.
Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
---
kernel/printk/printk.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- linux-next-20220228.orig/kernel/printk/printk.c
+++ linux-next-20220228/kernel/printk/printk.c
@@ -152,8 +152,10 @@ static int __control_devkmsg(char *str)
static int __init control_devkmsg(char *str)
{
- if (__control_devkmsg(str) < 0)
+ if (__control_devkmsg(str) < 0) {
+ pr_warn("printk.devkmsg: bad option string '%s'\n", str);
return 1;
+ }
/*
* Set sysctl string accordingly:
@@ -172,7 +174,7 @@ static int __init control_devkmsg(char *
*/
devkmsg_log |= DEVKMSG_LOG_MASK_LOCK;
- return 0;
+ return 1;
}
__setup("printk.devkmsg=", control_devkmsg);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: fix return value of printk.devkmsg __setup handler
2022-02-28 22:05 [PATCH] printk: fix return value of printk.devkmsg __setup handler Randy Dunlap
@ 2022-03-01 12:58 ` John Ogness
2022-03-01 15:50 ` Randy Dunlap
2022-03-01 15:36 ` Petr Mladek
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: John Ogness @ 2022-03-01 12:58 UTC (permalink / raw)
To: Randy Dunlap, linux-kernel
Cc: Randy Dunlap, Igor Zhbanov, Borislav Petkov, Andrew Morton,
Petr Mladek, Sergey Senozhatsky, Steven Rostedt
On 2022-02-28, Randy Dunlap <rdunlap@infradead.org> wrote:
> If an invalid option value is used with "printk.devkmsg=<value>",
> it is silently ignored.
> If a valid option value is used, it is honored but the wrong return
> value (0) is used, indicating that the command line option had an
> error and was not handled. This string is not added to init's
> environment strings due to init/main.c::unknown_bootoption()
> checking for a '.' in the boot option string and then considering
> that string to be an "Unused module parameter".
>
> Print a warning message if a bad option string is used.
> Always return 1 from the __setup handler to indicate that the command
> line option has been handled.
>
> Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
The message at this link is very helpful in explaining the state of
declaring kernel parameters. Hopefully someday someone will document
and/or comment this stuff.
John Ogness
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: fix return value of printk.devkmsg __setup handler
2022-03-01 12:58 ` John Ogness
@ 2022-03-01 15:50 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2022-03-01 15:50 UTC (permalink / raw)
To: John Ogness, linux-kernel
Cc: Igor Zhbanov, Borislav Petkov, Andrew Morton, Petr Mladek,
Sergey Senozhatsky, Steven Rostedt
On 3/1/22 04:58, John Ogness wrote:
> On 2022-02-28, Randy Dunlap <rdunlap@infradead.org> wrote:
>> If an invalid option value is used with "printk.devkmsg=<value>",
>> it is silently ignored.
>> If a valid option value is used, it is honored but the wrong return
>> value (0) is used, indicating that the command line option had an
>> error and was not handled. This string is not added to init's
>> environment strings due to init/main.c::unknown_bootoption()
>> checking for a '.' in the boot option string and then considering
>> that string to be an "Unused module parameter".
>>
>> Print a warning message if a bad option string is used.
>> Always return 1 from the __setup handler to indicate that the command
>> line option has been handled.
>>
>> Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
>
> Reviewed-by: John Ogness <john.ogness@linutronix.de>
>
>> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
>
> The message at this link is very helpful in explaining the state of
> declaring kernel parameters. Hopefully someday someone will document
> and/or comment this stuff.
I have added some docs to include/linux/init.h.
Andrew has it in his mmotm queue.
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: fix return value of printk.devkmsg __setup handler
2022-02-28 22:05 [PATCH] printk: fix return value of printk.devkmsg __setup handler Randy Dunlap
2022-03-01 12:58 ` John Ogness
@ 2022-03-01 15:36 ` Petr Mladek
2022-03-02 1:58 ` Sergey Senozhatsky
2022-03-02 8:24 ` Petr Mladek
3 siblings, 0 replies; 6+ messages in thread
From: Petr Mladek @ 2022-03-01 15:36 UTC (permalink / raw)
To: Randy Dunlap
Cc: linux-kernel, Igor Zhbanov, Borislav Petkov, Andrew Morton,
Sergey Senozhatsky, Steven Rostedt, John Ogness
On Mon 2022-02-28 14:05:56, Randy Dunlap wrote:
> If an invalid option value is used with "printk.devkmsg=<value>",
> it is silently ignored.
> If a valid option value is used, it is honored but the wrong return
> value (0) is used, indicating that the command line option had an
> error and was not handled. This string is not added to init's
> environment strings due to init/main.c::unknown_bootoption()
> checking for a '.' in the boot option string and then considering
> that string to be an "Unused module parameter".
>
> Print a warning message if a bad option string is used.
> Always return 1 from the __setup handler to indicate that the command
> line option has been handled.
>
> Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Good catch! I am learning something new every day :-)
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: fix return value of printk.devkmsg __setup handler
2022-02-28 22:05 [PATCH] printk: fix return value of printk.devkmsg __setup handler Randy Dunlap
2022-03-01 12:58 ` John Ogness
2022-03-01 15:36 ` Petr Mladek
@ 2022-03-02 1:58 ` Sergey Senozhatsky
2022-03-02 8:24 ` Petr Mladek
3 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2022-03-02 1:58 UTC (permalink / raw)
To: Randy Dunlap
Cc: linux-kernel, Igor Zhbanov, Borislav Petkov, Andrew Morton,
Petr Mladek, Sergey Senozhatsky, Steven Rostedt, John Ogness
On (22/02/28 14:05), Randy Dunlap wrote:
> If an invalid option value is used with "printk.devkmsg=<value>",
> it is silently ignored.
> If a valid option value is used, it is honored but the wrong return
> value (0) is used, indicating that the command line option had an
> error and was not handled. This string is not added to init's
> environment strings due to init/main.c::unknown_bootoption()
> checking for a '.' in the boot option string and then considering
> that string to be an "Unused module parameter".
>
> Print a warning message if a bad option string is used.
> Always return 1 from the __setup handler to indicate that the command
> line option has been handled.
>
> Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: fix return value of printk.devkmsg __setup handler
2022-02-28 22:05 [PATCH] printk: fix return value of printk.devkmsg __setup handler Randy Dunlap
` (2 preceding siblings ...)
2022-03-02 1:58 ` Sergey Senozhatsky
@ 2022-03-02 8:24 ` Petr Mladek
3 siblings, 0 replies; 6+ messages in thread
From: Petr Mladek @ 2022-03-02 8:24 UTC (permalink / raw)
To: Randy Dunlap
Cc: linux-kernel, Igor Zhbanov, Borislav Petkov, Andrew Morton,
Sergey Senozhatsky, Steven Rostedt, John Ogness
On Mon 2022-02-28 14:05:56, Randy Dunlap wrote:
> If an invalid option value is used with "printk.devkmsg=<value>",
> it is silently ignored.
> If a valid option value is used, it is honored but the wrong return
> value (0) is used, indicating that the command line option had an
> error and was not handled. This string is not added to init's
> environment strings due to init/main.c::unknown_bootoption()
> checking for a '.' in the boot option string and then considering
> that string to be an "Unused module parameter".
>
> Print a warning message if a bad option string is used.
> Always return 1 from the __setup handler to indicate that the command
> line option has been handled.
>
> Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: John Ogness <john.ogness@linutronix.de>
The patch has been committed into printk/linux.git, branch for-5.18.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-02 8:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 22:05 [PATCH] printk: fix return value of printk.devkmsg __setup handler Randy Dunlap
2022-03-01 12:58 ` John Ogness
2022-03-01 15:50 ` Randy Dunlap
2022-03-01 15:36 ` Petr Mladek
2022-03-02 1:58 ` Sergey Senozhatsky
2022-03-02 8:24 ` Petr Mladek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.