* [for-linus][PATCH 0/4] tracing: Fixes for 5.6
@ 2020-02-10 14:44 Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 1/4] tools/bootconfig: Fix wrong __VA_ARGS__ usage Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steven Rostedt @ 2020-02-10 14:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
Gustavo A. R. Silva (1):
tracing/kprobe: Fix uninitialized variable bug
Masami Hiramatsu (2):
tools/bootconfig: Fix wrong __VA_ARGS__ usage
bootconfig: Remove unneeded CONFIG_LIBXBC
Steven Rostedt (VMware) (1):
bootconfig: Use parse_args() to find bootconfig and '--'
----
init/Kconfig | 1 -
init/main.c | 37 ++++++++++++++++++++++++++-------
kernel/trace/trace_kprobe.c | 2 +-
lib/Kconfig | 3 ---
lib/Makefile | 2 +-
tools/bootconfig/include/linux/printk.h | 2 +-
6 files changed, 33 insertions(+), 14 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [for-linus][PATCH 1/4] tools/bootconfig: Fix wrong __VA_ARGS__ usage
2020-02-10 14:44 [for-linus][PATCH 0/4] tracing: Fixes for 5.6 Steven Rostedt
@ 2020-02-10 14:44 ` Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 2/4] bootconfig: Remove unneeded CONFIG_LIBXBC Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2020-02-10 14:44 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Michael Ellerman, Masami Hiramatsu
From: Masami Hiramatsu <mhiramat@kernel.org>
Since printk() wrapper macro uses __VA_ARGS__ without "##" prefix, it causes
a build error if there is no variable arguments (e.g. only fmt is
specified.) To fix this error, use ##__VA_ARGS__ instead of __VAR_ARGS__.
Link: http://lkml.kernel.org/r/158108370130.2758.10893830923800978011.stgit@devnote2
Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command")
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tools/bootconfig/include/linux/printk.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bootconfig/include/linux/printk.h b/tools/bootconfig/include/linux/printk.h
index 017bcd6912a5..e978a63d3222 100644
--- a/tools/bootconfig/include/linux/printk.h
+++ b/tools/bootconfig/include/linux/printk.h
@@ -7,7 +7,7 @@
/* controllable printf */
extern int pr_output;
#define printk(fmt, ...) \
- (pr_output ? printf(fmt, __VA_ARGS__) : 0)
+ (pr_output ? printf(fmt, ##__VA_ARGS__) : 0)
#define pr_err printk
#define pr_warn printk
--
2.24.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-linus][PATCH 2/4] bootconfig: Remove unneeded CONFIG_LIBXBC
2020-02-10 14:44 [for-linus][PATCH 0/4] tracing: Fixes for 5.6 Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 1/4] tools/bootconfig: Fix wrong __VA_ARGS__ usage Steven Rostedt
@ 2020-02-10 14:44 ` Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 3/4] tracing/kprobe: Fix uninitialized variable bug Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 4/4] bootconfig: Use parse_args() to find bootconfig and -- Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2020-02-10 14:44 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Geert Uytterhoeven, Masami Hiramatsu
From: Masami Hiramatsu <mhiramat@kernel.org>
Since there is no user except CONFIG_BOOT_CONFIG and no plan
to use it from other functions, CONFIG_LIBXBC can be removed
and we can use CONFIG_BOOT_CONFIG directly.
Link: http://lkml.kernel.org/r/158098769281.939.16293492056419481105.stgit@devnote2
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
init/Kconfig | 1 -
lib/Kconfig | 3 ---
lib/Makefile | 2 +-
3 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index 9506299a53e3..4a672c6629d0 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1218,7 +1218,6 @@ endif
config BOOT_CONFIG
bool "Boot config support"
depends on BLK_DEV_INITRD
- select LIBXBC
default y
help
Extra boot config allows system admin to pass a config file as
diff --git a/lib/Kconfig b/lib/Kconfig
index 10012b646009..6e790dc55c5b 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -566,9 +566,6 @@ config DIMLIB
config LIBFDT
bool
-config LIBXBC
- bool
-
config OID_REGISTRY
tristate
help
diff --git a/lib/Makefile b/lib/Makefile
index 75a64d2552a2..74c1223828c1 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -228,7 +228,7 @@ $(foreach file, $(libfdt_files), \
$(eval CFLAGS_$(file) = -I $(srctree)/scripts/dtc/libfdt))
lib-$(CONFIG_LIBFDT) += $(libfdt_files)
-lib-$(CONFIG_LIBXBC) += bootconfig.o
+lib-$(CONFIG_BOOT_CONFIG) += bootconfig.o
obj-$(CONFIG_RBTREE_TEST) += rbtree_test.o
obj-$(CONFIG_INTERVAL_TREE_TEST) += interval_tree_test.o
--
2.24.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-linus][PATCH 3/4] tracing/kprobe: Fix uninitialized variable bug
2020-02-10 14:44 [for-linus][PATCH 0/4] tracing: Fixes for 5.6 Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 1/4] tools/bootconfig: Fix wrong __VA_ARGS__ usage Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 2/4] bootconfig: Remove unneeded CONFIG_LIBXBC Steven Rostedt
@ 2020-02-10 14:44 ` Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 4/4] bootconfig: Use parse_args() to find bootconfig and -- Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2020-02-10 14:44 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Tom Zanussi, Masami Hiramatsu,
Gustavo A. R. Silva
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
There is a potential execution path in which variable *ret* is returned
without being properly initialized, previously.
Fix this by initializing variable *ret* to 0.
Link: http://lkml.kernel.org/r/20200205223404.GA3379@embeddedor
Addresses-Coverity-ID: 1491142 ("Uninitialized scalar variable")
Fixes: 2a588dd1d5d6 ("tracing: Add kprobe event command generation functions")
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/trace_kprobe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 51efc790aea8..21bafd48f2ac 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1012,7 +1012,7 @@ int __kprobe_event_add_fields(struct dynevent_cmd *cmd, ...)
{
struct dynevent_arg arg;
va_list args;
- int ret;
+ int ret = 0;
if (cmd->type != DYNEVENT_TYPE_KPROBE)
return -EINVAL;
--
2.24.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-linus][PATCH 4/4] bootconfig: Use parse_args() to find bootconfig and --
2020-02-10 14:44 [for-linus][PATCH 0/4] tracing: Fixes for 5.6 Steven Rostedt
` (2 preceding siblings ...)
2020-02-10 14:44 ` [for-linus][PATCH 3/4] tracing/kprobe: Fix uninitialized variable bug Steven Rostedt
@ 2020-02-10 14:44 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2020-02-10 14:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Kees Cook, Masami Hiramatsu
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
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: 7495e0926fdf3 ("bootconfig: Only load bootconfig if "bootconfig" is on the kernel cmdline")
Fixes: 1319916209ce8 ("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 | 37 ++++++++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 7 deletions(-)
diff --git a/init/main.c b/init/main.c
index 491f1cdb3105..59248717c925 100644
--- a/init/main.c
+++ b/init/main.c
@@ -142,6 +142,15 @@ static char *extra_command_line;
/* Extra init arguments */
static char *extra_init_args;
+#ifdef CONFIG_BOOT_CONFIG
+/* Is bootconfig on command line? */
+static bool bootconfig_found;
+static bool initargs_found;
+#else
+# define bootconfig_found false
+# define initargs_found false
+#endif
+
static char *execute_command;
static char *ramdisk_execute_command;
@@ -336,17 +345,30 @@ u32 boot_config_checksum(unsigned char *p, u32 size)
return ret;
}
+static int __init bootconfig_params(char *param, char *val,
+ const char *unused, void *arg)
+{
+ if (strcmp(param, "bootconfig") == 0) {
+ bootconfig_found = true;
+ } else if (strcmp(param, "--") == 0) {
+ initargs_found = true;
+ }
+ return 0;
+}
+
static void __init setup_boot_config(const char *cmdline)
{
+ static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
u32 size, csum;
char *data, *copy;
- const char *p;
u32 *hdr;
int ret;
- p = strstr(cmdline, "bootconfig");
- if (!p || (p != cmdline && !isspace(*(p-1))) ||
- (p[10] && !isspace(p[10])))
+ strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
+ parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
+ bootconfig_params);
+
+ if (!bootconfig_found)
return;
if (!initrd_end)
@@ -563,11 +585,12 @@ static void __init setup_command_line(char *command_line)
* to init.
*/
len = strlen(saved_command_line);
- if (!strstr(boot_command_line, " -- ")) {
+ if (initargs_found) {
+ saved_command_line[len++] = ' ';
+ } else {
strcpy(saved_command_line + len, " -- ");
len += 4;
- } else
- saved_command_line[len++] = ' ';
+ }
strcpy(saved_command_line + len, extra_init_args);
}
--
2.24.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-02-10 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-10 14:44 [for-linus][PATCH 0/4] tracing: Fixes for 5.6 Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 1/4] tools/bootconfig: Fix wrong __VA_ARGS__ usage Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 2/4] bootconfig: Remove unneeded CONFIG_LIBXBC Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 3/4] tracing/kprobe: Fix uninitialized variable bug Steven Rostedt
2020-02-10 14:44 ` [for-linus][PATCH 4/4] bootconfig: Use parse_args() to find bootconfig and -- Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox