]> git.baikalelectronics.ru Git - kernel.git/commit
bootconfig: Use parse_args() to find bootconfig and '--'
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 8 Feb 2020 00:07:37 +0000 (19:07 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 10 Feb 2020 17:07:42 +0000 (12:07 -0500)
commit16496b10d4569c6fab6fb4a0f88f9cf8a6197d4f
tree0ec19f4ea031f697c2729879cb88cd58f8270623
parent19fa6189649d5970ec464bb614cbe4c512dacd19
bootconfig: Use parse_args() to find bootconfig and '--'

The current implementation does a naive search of "bootconfig" on the kernel
command line. But this could find "bootconfig" that is part of another
option in quotes (although highly unlikely). But it also needs to find '--'
on the kernel command line to know if it should append a '--' or not when a
bootconfig in the initrd file has an "init" section. The check uses the
naive strstr() to find to see if it exists. But this can return a false
positive if it exists in an option and then the "init" section in the initrd
will not be appended properly.

Using parse_args() to find both of these will solve both of these problems.

Link: https://lore.kernel.org/r/202002070954.C18E7F58B@keescook
Fixes: f8d02f2049ef1 ("bootconfig: Only load bootconfig if "bootconfig" is on the kernel cmdline")
Fixes: b5ce1bcefd314 ("bootconfig: init: Allow admin to use bootconfig for init command line")
Reported-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
init/main.c