tracing: Fixes for 5.6
Subsystems (2)
Steven Rostedt
maintainercover tracing: Fixes for 5.6
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(-)
Steven Rostedt
maintainerPATCH 1/4 tools/bootconfig: Fix wrong __VA_ARGS__ usage
From: Masami Hiramatsu <[email protected]>
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__.
--- tools/bootconfig/include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/include/linux/printk.h +1 -1
@@ -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
Signature · 1 line
2.24.1
Steven Rostedt
maintainerPATCH 2/4 bootconfig: Remove unneeded CONFIG_LIBXBC
In reply to Steven RostedtFrom: Masami Hiramatsu <[email protected]>
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.
--- init/Kconfig | 1 - lib/Kconfig | 3 --- lib/Makefile | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-)
init/Kconfig +0 -1
@@ -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
lib/Kconfig +0 -3
@@ -566,9 +566,6 @@ config DIMLIB config LIBFDT bool -config LIBXBC - bool - config OID_REGISTRY tristate help
lib/Makefile +1 -1
@@ -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
Signature · 1 line
2.24.1
Steven Rostedt
maintainerPATCH 3/4 tracing/kprobe: Fix uninitialized variable bug
In reply to Steven RostedtFrom: "Gustavo A. R. Silva" <[email protected]>
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.
Addresses-Coverity-ID: 1491142 ("Uninitialized scalar variable")
--- kernel/trace/trace_kprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_kprobe.c +1 -1
@@ -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 ;
Signature · 1 line
2.24.1
Steven Rostedt
maintainerPATCH 4/4 bootconfig: Use parse_args() to find bootconfig and --
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
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.
--- init/main.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
init/main.c +30 -7
@@ -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); }
Signature · 1 line
2.24.1