diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-20 13:35:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-20 13:35:48 -0400 |
commit | f780f00d723d991353b2a97a8a844ffefbc40505 (patch) | |
tree | 7054dad0c63507c257c61be9668d631d4482ae00 | |
parent | 97f78c7de8ae38c007fec406d40df99ae62b36de (diff) | |
parent | 0ded5174e976e2b2a354fe38abf1ebf4492c6dc3 (diff) |
Merge tag 'trace-v4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt:
"Two fixes for the tracing system:
- When trace_printk() is used with a non constant format descriptor,
it adds a NULL pointer into the trace format section, and the code
isn't prepared to deal with it. This bug appeared by a change that
was added in v3.5.
- The ftracetest (selftests section) can't handle testing histograms
when histograms are not configured. Currently it shows that they
fail the test, when they should state that they are unsupported.
This bug was added in the 4.7 merge window with the addition of the
historgram code"
* tag 'trace-v4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
ftracetest: Fix hist unsupported result in hist selftests
tracing: Handle NULL formats in hold_module_trace_bprintk_format()
4 files changed, 18 insertions, 16 deletions
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c index f96f0383f6c6..ad1d6164e946 100644 --- a/kernel/trace/trace_printk.c +++ b/kernel/trace/trace_printk.c | |||
@@ -36,6 +36,10 @@ struct trace_bprintk_fmt { | |||
36 | static inline struct trace_bprintk_fmt *lookup_format(const char *fmt) | 36 | static inline struct trace_bprintk_fmt *lookup_format(const char *fmt) |
37 | { | 37 | { |
38 | struct trace_bprintk_fmt *pos; | 38 | struct trace_bprintk_fmt *pos; |
39 | |||
40 | if (!fmt) | ||
41 | return ERR_PTR(-EINVAL); | ||
42 | |||
39 | list_for_each_entry(pos, &trace_bprintk_fmt_list, list) { | 43 | list_for_each_entry(pos, &trace_bprintk_fmt_list, list) { |
40 | if (!strcmp(pos->fmt, fmt)) | 44 | if (!strcmp(pos->fmt, fmt)) |
41 | return pos; | 45 | return pos; |
@@ -57,7 +61,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end) | |||
57 | for (iter = start; iter < end; iter++) { | 61 | for (iter = start; iter < end; iter++) { |
58 | struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter); | 62 | struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter); |
59 | if (tb_fmt) { | 63 | if (tb_fmt) { |
60 | *iter = tb_fmt->fmt; | 64 | if (!IS_ERR(tb_fmt)) |
65 | *iter = tb_fmt->fmt; | ||
61 | continue; | 66 | continue; |
62 | } | 67 | } |
63 | 68 | ||
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc index c2b61c4fda11..0bf5085281f3 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc | |||
@@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then | |||
23 | exit_unsupported | 23 | exit_unsupported |
24 | fi | 24 | fi |
25 | 25 | ||
26 | reset_tracer | 26 | if [ ! -f events/sched/sched_process_fork/hist ]; then |
27 | do_reset | ||
28 | |||
29 | FEATURE=`grep hist events/sched/sched_process_fork/trigger` | ||
30 | if [ -z "$FEATURE" ]; then | ||
31 | echo "hist trigger is not supported" | 27 | echo "hist trigger is not supported" |
32 | exit_unsupported | 28 | exit_unsupported |
33 | fi | 29 | fi |
34 | 30 | ||
31 | reset_tracer | ||
32 | do_reset | ||
33 | |||
35 | echo "Test histogram with execname modifier" | 34 | echo "Test histogram with execname modifier" |
36 | 35 | ||
37 | echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger | 36 | echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger |
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc index b2902d42a537..a00184cd9c95 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc | |||
@@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then | |||
23 | exit_unsupported | 23 | exit_unsupported |
24 | fi | 24 | fi |
25 | 25 | ||
26 | reset_tracer | 26 | if [ ! -f events/sched/sched_process_fork/hist ]; then |
27 | do_reset | ||
28 | |||
29 | FEATURE=`grep hist events/sched/sched_process_fork/trigger` | ||
30 | if [ -z "$FEATURE" ]; then | ||
31 | echo "hist trigger is not supported" | 27 | echo "hist trigger is not supported" |
32 | exit_unsupported | 28 | exit_unsupported |
33 | fi | 29 | fi |
34 | 30 | ||
31 | reset_tracer | ||
32 | do_reset | ||
33 | |||
35 | echo "Test histogram basic tigger" | 34 | echo "Test histogram basic tigger" |
36 | 35 | ||
37 | echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger | 36 | echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger |
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc index 03c4a46561fc..3478b00ead57 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc | |||
@@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then | |||
23 | exit_unsupported | 23 | exit_unsupported |
24 | fi | 24 | fi |
25 | 25 | ||
26 | reset_tracer | 26 | if [ ! -f events/sched/sched_process_fork/hist ]; then |
27 | do_reset | ||
28 | |||
29 | FEATURE=`grep hist events/sched/sched_process_fork/trigger` | ||
30 | if [ -z "$FEATURE" ]; then | ||
31 | echo "hist trigger is not supported" | 27 | echo "hist trigger is not supported" |
32 | exit_unsupported | 28 | exit_unsupported |
33 | fi | 29 | fi |
34 | 30 | ||
31 | reset_tracer | ||
32 | do_reset | ||
33 | |||
35 | reset_trigger | 34 | reset_trigger |
36 | 35 | ||
37 | echo "Test histogram multiple tiggers" | 36 | echo "Test histogram multiple tiggers" |