tracing: Fixes for 5.17-rc1
Subsystems (5)
Steven Rostedt
maintainerLinus,
Tracing fixes for 5.17-rc1:
- Limit mcount build time sorting to only those archs that we know it works for.
- Fix memory leak in error path of histogram setup
- Fix and clean up rel_loc array out of bounds issue
- tools/rtla documentation fixes
- Fix issues with histogram logic
Please pull the latest trace-v5.17-rc1 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.17-rc1
Tag SHA1: d0f57822f437071b7f79a57352c33353aeb6a260 Head SHA1: 67ab5eb71b37b55f7c5522d080a1b42823351776
Kees Cook (1):
tracing/perf: Avoid -Warray-bounds warning for __rel_loc macro
Masami Hiramatsu (1):
tracing: Avoid -Warray-bounds warning for __rel_loc macro
Shuah Khan (2):
rtla: Make doc build optional tools/tracing: Update Makefile to build rtla
Steven Rostedt (Google) (1):
ftrace: Have architectures opt-in for mcount build time sorting
Tom Zanussi (4):
tracing: Fix smatch warning for null glob in event_hist_trigger_parse()
tracing: Fix smatch warning for do while check in event_hist_trigger_parse()
tracing: Propagate is_signed to expression
tracing: Don't inc err_log entry count if entry allocation fails
Xiaoke Wang (1):
tracing/histogram: Fix a potential memory leak for kstrdup()
----
arch/arm/Kconfig | 1 + arch/x86/Kconfig | 1 + include/trace/perf.h | 5 +++-- include/trace/trace_events.h | 9 +++++---- kernel/trace/Kconfig | 8 +++++++- kernel/trace/trace.c | 3 ++- kernel/trace/trace_events_hist.c | 10 ++++++++-- scripts/Makefile | 2 +- tools/tracing/Makefile | 18 ++++++++++++++---- tools/tracing/rtla/Makefile | 2 +- 10 files changed, 43 insertions(+), 16 deletions(-)
---------------------------
arch/arm/Kconfig +1 -0
@@ -83,6 +83,7 @@ config ARM select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 select HAVE_CONTEXT_TRACKING select HAVE_C_RECORDMCOUNT + select HAVE_BUILDTIME_MCOUNT_SORT select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL select HAVE_DMA_CONTIGUOUS if MMU select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
arch/x86/Kconfig +1 -0
@@ -186,6 +186,7 @@ config X86 select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING select HAVE_C_RECORDMCOUNT select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION + select HAVE_BUILDTIME_MCOUNT_SORT select HAVE_DEBUG_KMEMLEAK select HAVE_DMA_CONTIGUOUS select HAVE_DYNAMIC_FTRACE
include/trace/perf.h +3 -2
@@ -23,8 +23,9 @@#undef __get_rel_dynamic_array#define __get_rel_dynamic_array (field) \ - ((void *)(&__entry->__rel_loc_##field) + \ - sizeof(__entry->__rel_loc_##field) + \ + ((void *)__entry + \ + offsetof(typeof(*__entry), __rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ (__entry->__rel_loc_##field & 0xffff))#undef __get_rel_dynamic_array_len
include/trace/trace_events.h +5 -4
@@ -128,7 +128,7 @@ TRACE_MAKE_SYSTEM_STR(); struct trace_event_raw_##name { \ struct trace_entry ent; \ tstruct \ - char __data[0]; \ + char __data[]; \ }; \ \ static struct trace_event_class event_class_##name;
@@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR();#define __get_str (field) ((char *)__get_dynamic_array(field))#undef __get_rel_dynamic_array -#define __get_rel_dynamic_array (field) \ - ((void *)(&__entry->__rel_loc_##field) + \ - sizeof(__entry->__rel_loc_##field) + \ +#define __get_rel_dynamic_array (field) \ + ((void *)__entry + \ + offsetof(typeof(*__entry), __rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ (__entry->__rel_loc_##field & 0xffff))#undef __get_rel_dynamic_array_len
kernel/trace/Kconfig +7 -1
@@ -70,10 +70,16 @@ config HAVE_C_RECORDMCOUNT help C version of recordmcount available? +config HAVE_BUILDTIME_MCOUNT_SORT + bool + help + An architecture selects this if it sorts the mcount_loc section + at build time. + config BUILDTIME_MCOUNT_SORT bool default y - depends on BUILDTIME_TABLE_SORT && !S390 + depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE help Sort the mcount_loc section at build time.
kernel/trace/trace.c +2 -1
@@ -7740,7 +7740,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) err =kzalloc (sizeof (*err),GFP_KERNEL );if (!err) err =ERR_PTR (-ENOMEM ); - tr->n_err_log_entries++; +else + tr->n_err_log_entries++;return err; }
kernel/trace/trace_events_hist.c +8 -2
@@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, (HIST_FIELD_FL_TIMESTAMP |HIST_FIELD_FL_TIMESTAMP_USECS ); expr->fn = hist_field_unary_minus; expr->operands[0 ] = operand1; + expr->size = operand1->size; + expr->is_signed = operand1->is_signed; expr->operator =FIELD_OP_UNARY_MINUS ; expr->name =expr_str (expr,0 ); expr->type =kstrdup_const (operand1->type,GFP_KERNEL );
@@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,/* The operand sizes should be the same, so just pick one */ expr->size = operand1->size; + expr->is_signed = operand1->is_signed; expr->operator = field_op; expr->type =kstrdup_const (operand1->type,GFP_KERNEL );
@@ -3935,6 +3938,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, var_ref_idx =find_var_ref_idx (hist_data, var_ref);if (WARN_ON (var_ref_idx <0 )) { +kfree (p); ret = var_ref_idx; goto err; }
@@ -6163,7 +6167,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,lockdep_assert_held (&event_mutex); -if (glob &&strlen (glob)) { +WARN_ON (!glob); + +if (strlen (glob)) {hist_err_clear ();last_cmd_set (file, param); }
@@ -6196,7 +6202,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,continue ; }break ; - }while (p); + }while (1 );if (!p) param =NULL ;
scripts/Makefile +1 -1
@@ -25,7 +25,7 @@ HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED endif -ifdef CONFIG_DYNAMIC_FTRACE +ifdef CONFIG_BUILDTIME_MCOUNT_SORT HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED endif
tools/tracing/Makefile +14 -4
@@ -1,11 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 include ../scripts/Makefile.include -all: latency +all: latency rtla -clean: latency_clean +clean: latency_clean rtla_clean -install: latency_install +install: latency_install rtla_install latency: $(call descend,latency)
@@ -16,4 +16,14 @@ latency_install: latency_clean: $(call descend,latency,clean) -.PHONY: all install clean latency latency_install latency_clean +rtla: + $(call descend,rtla) + +rtla_install: + $(call descend,rtla,install) + +rtla_clean: + $(call descend,rtla,clean) + +.PHONY: all install clean latency latency_install latency_clean \ + rtla rtla_install rtla_clean
tools/tracing/rtla/Makefile +1 -1
@@ -59,7 +59,7 @@ endif .PHONY: all all: rtla -rtla: $(OBJ) doc +rtla: $(OBJ) $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) static: $(OBJ)
The pull request you sent on Fri, 28 Jan 2022 12:20:20 -0500:
The pull request you sent on Fri, 28 Jan 2022 12:20:20 -0500:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.gittrace-v5.17-rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/df0001545b2769e6aa33a45e26c00a4cdac48c29
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html