History

Merge tag 'trace-v5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pulltracing fixes from Steven Rostedt: - 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 * tag 'trace-v5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Don't inc err_log entry count if entry allocation fails tracing: Propagate is_signed to expression tracing: Fix smatch warning for do while check in event_hist_trigger_parse() tracing: Fix smatch warning for null glob in event_hist_trigger_parse() tools/tracing: Update Makefile to build rtla rtla: Make doc build optional tracing/perf: Avoid -Warray-bounds warning for __rel_loc macro tracing: Avoid -Warray-bounds warning for __rel_loc macro tracing/histogram: Fix a potential memory leak for kstrdup() ftrace: Have architectures opt-in for mcount build time sorting

Linus Torvalds committed 4 years ago

Commit df000152 parents 76fcbc9 67ab5eb10 files · +43 −16Browse files

Unified · Split

10 files
  1. arch/arm/Kconfig +1 −0
  2. arch/x86/Kconfig +1 −0
  3. include/trace/perf.h +3 −2
  4. include/trace/trace_events.h +5 −4
  5. kernel/trace/Kconfig +7 −1
  6. kernel/trace/trace.c +2 −1
  7. kernel/trace/trace_events_hist.c +8 −2
  8. scripts/Makefile +1 −1
  9. tools/tracing/Makefile +14 −4
  10. tools/tracing/rtla/Makefile +1 −1
arch/arm/Kconfig+1−0
@@ -83,6 +83,7 @@ config ARM · 82 unmodified lines
83 select HAVE_EBPF_JIT if !CPU_ENDIAN_BE3283 select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
84 select HAVE_CONTEXT_TRACKING84 select HAVE_CONTEXT_TRACKING
85 select HAVE_C_RECORDMCOUNT85 select HAVE_C_RECORDMCOUNT
86 select HAVE_BUILDTIME_MCOUNT_SORT
86 select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL87 select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL
87 select HAVE_DMA_CONTIGUOUS if MMU88 select HAVE_DMA_CONTIGUOUS if MMU
88 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU89 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
arch/x86/Kconfig+1−0
@@ -186,6 +186,7 @@ config X86 · 185 unmodified lines
186 select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING186 select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING
187 select HAVE_C_RECORDMCOUNT187 select HAVE_C_RECORDMCOUNT
188 select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION188 select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION
189 select HAVE_BUILDTIME_MCOUNT_SORT
189 select HAVE_DEBUG_KMEMLEAK190 select HAVE_DEBUG_KMEMLEAK
190 select HAVE_DMA_CONTIGUOUS191 select HAVE_DMA_CONTIGUOUS
191 select HAVE_DYNAMIC_FTRACE192 select HAVE_DYNAMIC_FTRACE
include/trace/perf.h+3−2
@@ -23,8 +23,9 @@ · 22 unmodified lines
23 23
24#undef __get_rel_dynamic_array24#undef __get_rel_dynamic_array
25#define __get_rel_dynamic_array(field) \25#define __get_rel_dynamic_array(field) \
26 ((void *)(&__entry->__rel_loc_##field) + \26 ((void *)__entry + \
27 sizeof(__entry->__rel_loc_##field) + \27 offsetof(typeof(*__entry), __rel_loc_##field) + \
28 sizeof(__entry->__rel_loc_##field) + \
28 (__entry->__rel_loc_##field & 0xffff))29 (__entry->__rel_loc_##field & 0xffff))
29 30
30#undef __get_rel_dynamic_array_len31#undef __get_rel_dynamic_array_len
include/trace/trace_events.h+5−4
@@ -128,7 +128,7 @@ TRACE_MAKE_SYSTEM_STR(); · 127 unmodified lines
128 struct trace_event_raw_##name { \128 struct trace_event_raw_##name { \
129 struct trace_entry ent; \129 struct trace_entry ent; \
130 tstruct \130 tstruct \
131 char __data[0]; \131 char __data[]; \
132 }; \132 }; \
133 \133 \
134 static struct trace_event_class event_class_##name;134 static struct trace_event_class event_class_##name;
@@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR(); · 183 unmodified lines
318#define __get_str(field) ((char *)__get_dynamic_array(field))318#define __get_str(field) ((char *)__get_dynamic_array(field))
319 319
320#undef __get_rel_dynamic_array320#undef __get_rel_dynamic_array
321#define __get_rel_dynamic_array(field) \321#define __get_rel_dynamic_array(field) \
322 ((void *)(&__entry->__rel_loc_##field) + \322 ((void *)__entry + \
323 sizeof(__entry->__rel_loc_##field) + \323 offsetof(typeof(*__entry), __rel_loc_##field) + \
324 sizeof(__entry->__rel_loc_##field) + \
324 (__entry->__rel_loc_##field & 0xffff))325 (__entry->__rel_loc_##field & 0xffff))
325 326
326#undef __get_rel_dynamic_array_len327#undef __get_rel_dynamic_array_len
kernel/trace/Kconfig+7−1
@@ -70,10 +70,16 @@ config HAVE_C_RECORDMCOUNT · 69 unmodified lines
70 help70 help
71 C version of recordmcount available?71 C version of recordmcount available?
72 72
73config HAVE_BUILDTIME_MCOUNT_SORT
74 bool
75 help
76 An architecture selects this if it sorts the mcount_loc section
77 at build time.
78
73config BUILDTIME_MCOUNT_SORT79config BUILDTIME_MCOUNT_SORT
74 bool80 bool
75 default y81 default y
76 depends on BUILDTIME_TABLE_SORT && !S39082 depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE
77 help83 help
78 Sort the mcount_loc section at build time.84 Sort the mcount_loc section at build time.
79 85
kernel/trace/trace.c+2−1
@@ -7740,7 +7740,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) · 7739 unmodified lines
7740 err = kzalloc(sizeof(*err), GFP_KERNEL);7740 err = kzalloc(sizeof(*err), GFP_KERNEL);
7741 if (!err)7741 if (!err)
7742 err = ERR_PTR(-ENOMEM);7742 err = ERR_PTR(-ENOMEM);
7743 tr->n_err_log_entries++;7743 else
7744 tr->n_err_log_entries++;
7744 7745
7745 return err;7746 return err;
7746 }7747 }
kernel/trace/trace_events_hist.c+8−2
@@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, · 2502 unmodified lines
2503 (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS);2503 (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS);
2504 expr->fn = hist_field_unary_minus;2504 expr->fn = hist_field_unary_minus;
2505 expr->operands[0] = operand1;2505 expr->operands[0] = operand1;
2506 expr->size = operand1->size;
2507 expr->is_signed = operand1->is_signed;
2506 expr->operator = FIELD_OP_UNARY_MINUS;2508 expr->operator = FIELD_OP_UNARY_MINUS;
2507 expr->name = expr_str(expr, 0);2509 expr->name = expr_str(expr, 0);
2508 expr->type = kstrdup_const(operand1->type, GFP_KERNEL);2510 expr->type = kstrdup_const(operand1->type, GFP_KERNEL);
@@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, · 210 unmodified lines
2719 2721
2720 /* The operand sizes should be the same, so just pick one */2722 /* The operand sizes should be the same, so just pick one */
2721 expr->size = operand1->size;2723 expr->size = operand1->size;
2724 expr->is_signed = operand1->is_signed;
2722 2725
2723 expr->operator = field_op;2726 expr->operator = field_op;
2724 expr->type = kstrdup_const(operand1->type, GFP_KERNEL);2727 expr->type = kstrdup_const(operand1->type, GFP_KERNEL);
@@ -3935,6 +3938,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, · 1210 unmodified lines
3935 3938
3936 var_ref_idx = find_var_ref_idx(hist_data, var_ref);3939 var_ref_idx = find_var_ref_idx(hist_data, var_ref);
3937 if (WARN_ON(var_ref_idx < 0)) {3940 if (WARN_ON(var_ref_idx < 0)) {
3941 kfree(p);
3938 ret = var_ref_idx;3942 ret = var_ref_idx;
3939 goto err;3943 goto err;
3940 }3944 }
@@ -6163,7 +6167,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 2222 unmodified lines
6163 6167
6164 lockdep_assert_held(&event_mutex);6168 lockdep_assert_held(&event_mutex);
6165 6169
6166 if (glob && strlen(glob)) {6170 WARN_ON(!glob);
6171
6172 if (strlen(glob)) {
6167 hist_err_clear();6173 hist_err_clear();
6168 last_cmd_set(file, param);6174 last_cmd_set(file, param);
6169 }6175 }
@@ -6196,7 +6202,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 26 unmodified lines
6196 continue;6202 continue;
6197 }6203 }
6198 break;6204 break;
6199 } while (p);6205 } while (1);
6200 6206
6201 if (!p)6207 if (!p)
6202 param = NULL;6208 param = NULL;
scripts/Makefile+1−1
@@ -25,7 +25,7 @@ HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include · 24 unmodified lines
25HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED25HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
26endif26endif
27 27
28ifdef CONFIG_DYNAMIC_FTRACE28ifdef CONFIG_BUILDTIME_MCOUNT_SORT
29HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED29HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
30endif30endif
31 31
tools/tracing/Makefile+14−4
@@ -1,11 +1,11 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2include ../scripts/Makefile.include2include ../scripts/Makefile.include
3 3
4all: latency4all: latency rtla
5 5
6clean: latency_clean6clean: latency_clean rtla_clean
7 7
8install: latency_install8install: latency_install rtla_install
9 9
10latency:10latency:
11 $(call descend,latency)11 $(call descend,latency)
@@ -16,4 +16,14 @@ latency_install: · 4 unmodified lines
16latency_clean:16latency_clean:
17 $(call descend,latency,clean)17 $(call descend,latency,clean)
18 18
19.PHONY: all install clean latency latency_install latency_clean19rtla:
20 $(call descend,rtla)
21
22rtla_install:
23 $(call descend,rtla,install)
24
25rtla_clean:
26 $(call descend,rtla,clean)
27
28.PHONY: all install clean latency latency_install latency_clean \
29 rtla rtla_install rtla_clean
tools/tracing/rtla/Makefile+1−1
@@ -59,7 +59,7 @@ endif · 58 unmodified lines
59.PHONY: all59.PHONY: all
60all: rtla60all: rtla
61 61
62rtla: $(OBJ) doc62rtla: $(OBJ)
63 $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)63 $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)
64 64
65static: $(OBJ)65static: $(OBJ)