1
0
Fork 0
remarkable-linux/kernel/trace
Steven Rostedt (Red Hat) 335f166ee3 tracing: Handle NULL formats in hold_module_trace_bprintk_format()
[ Upstream commit 70c8217acd ]

If a task uses a non constant string for the format parameter in
trace_printk(), then the trace_printk_fmt variable is set to NULL. This
variable is then saved in the __trace_printk_fmt section.

The function hold_module_trace_bprintk_format() checks to see if duplicate
formats are used by modules, and reuses them if so (saves them to the list
if it is new). But this function calls lookup_format() that does a strcmp()
to the value (which is now NULL) and can cause a kernel oops.

This wasn't an issue till 3debb0a9dd ("tracing: Fix trace_printk() to print
when not using bprintk()") which added "__used" to the trace_printk_fmt
variable, and before that, the kernel simply optimized it out (no NULL value
was saved).

The fix is simply to handle the NULL pointer in lookup_format() and have the
caller ignore the value if it was NULL.

Link: http://lkml.kernel.org/r/1464769870-18344-1-git-send-email-zhengjun.xing@intel.com

Reported-by: xingzhen <zhengjun.xing@intel.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Fixes: 3debb0a9dd ("tracing: Fix trace_printk() to print when not using bprintk()")
Cc: stable@vger.kernel.org # v3.5+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-07-10 20:20:00 -04:00
..
Kconfig Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-04-14 14:37:47 -07:00
Makefile bpf: Fix the build on BPF_SYSCALL=y && !CONFIG_TRACING kernels, make it more configurable 2015-04-02 16:28:06 +02:00
blktrace.c Merge branch 'for-3.19/core' of git://git.kernel.dk/linux-block 2014-12-13 14:14:23 -08:00
bpf_trace.c tracing: Allow BPF programs to call bpf_trace_printk() 2015-04-02 13:25:50 +02:00
ftrace.c ftrace: Fix breakage of set_ftrace_pid 2015-08-10 12:21:55 -07:00
power-traces.c PM / sleep: export suspend_resume trace event 2015-01-30 02:10:41 +01:00
ring_buffer.c ring-buffer: Prevent overflow of size in ring_buffer_resize() 2016-06-06 19:12:22 -04:00
ring_buffer_benchmark.c ring-buffer-benchmark: Fix the wrong sched_priority of producer 2015-06-11 09:27:58 -04:00
rpm-traces.c PM / Runtime: Introduce trace points for tracing rpm_* functions 2011-09-27 22:53:27 +02:00
trace.c tracing: Fix crash from reading trace_pipe with sendfile 2016-04-18 08:51:05 -04:00
trace.h tracing: Have branch tracer use recursive field of task struct 2015-08-03 09:29:12 -07:00
trace_benchmark.c tracing: Only calculate stats of tracepoint benchmarks for 2^32 times 2014-06-06 00:41:38 -04:00
trace_benchmark.h tracing: Add tracepoint benchmark tracepoint 2014-05-29 22:49:54 -04:00
trace_branch.c tracing: Have branch tracer use recursive field of task struct 2015-08-03 09:29:12 -07:00
trace_clock.c tracing: Fix wraparound problems in "uptime" trace clock 2014-07-21 09:56:12 -04:00
trace_entries.h tracing: %pF is only for function pointers 2015-03-25 08:57:22 -04:00
trace_event_perf.c perf: Avoid horrible stack usage 2015-01-14 15:11:45 +01:00
trace_events.c tracing: Don't display trigger file for events that can't be enabled 2016-05-17 13:42:56 -04:00
trace_events_filter.c tracing/filter: Do not allow infix to exceed end of string 2015-08-03 09:29:12 -07:00
trace_events_filter_test.h tracing/filter: Add startup tests for events filter 2011-08-19 14:35:59 -04:00
trace_events_trigger.c trace: Replace single-character seq_puts with seq_putc 2014-11-14 07:55:55 -05:00
trace_export.c tracing: remove ftrace:function TRACE_EVENT_FL_USE_CALL_FILTER flag 2015-03-25 08:57:23 -04:00
trace_functions.c tracing/trivial: Fix typos and make an int into a bool 2014-11-20 10:05:36 -05:00
trace_functions_graph.c This adds three fixes for the tracing code. 2015-04-22 11:27:36 -07:00
trace_irqsoff.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_kdb.c KGDB/KDB fixes and cleanups 2015-01-09 20:51:10 -08:00
trace_kprobe.c Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-04-14 14:37:47 -07:00
trace_mmiotrace.c tracing: Do not check return values of trace_seq_p*() for mmio tracer 2014-11-19 15:25:44 -05:00
trace_nop.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_output.c tracing: Make ftrace_print_array_seq compute buf_len 2015-05-06 23:03:23 -04:00
trace_output.h tracing: Add trace_seq_has_overflowed() and trace_handle_return() 2014-11-19 15:25:39 -05:00
trace_printk.c tracing: Handle NULL formats in hold_module_trace_bprintk_format() 2016-07-10 20:20:00 -04:00
trace_probe.c trace: Don't use __weak in header files 2015-03-25 08:57:23 -04:00
trace_probe.h Some clean ups and small fixes, but the biggest change is the addition 2015-04-14 10:49:03 -07:00
trace_sched_switch.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_sched_wakeup.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_selftest.c Seems that Peter Zijlstra added a new check that is making old 2014-10-12 07:28:55 -04:00
trace_selftest_dynamic.c ftrace: Add self-tests for multiple function trace users 2011-05-18 19:24:51 -04:00
trace_seq.c tracing: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:37 -08:00
trace_stack.c tracing: remove use of seq_printf return value 2015-04-15 16:35:25 -07:00
trace_stat.c tracing: Convert the tracing facility over to use tracefs 2015-02-03 12:48:41 -05:00
trace_stat.h tracing/stat: Add stat_release() callback 2009-07-10 12:14:05 +02:00
trace_syscalls.c perf: Avoid horrible stack usage 2015-01-14 15:11:45 +01:00
trace_uprobe.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00