Keita Suzuki
8595e2aadd
tracing: Avoid memory leak in process_system_preds()
commit 79e65c27f09683fbb50c33acab395d0ddf5302d2 upstream.
When failing in the allocation of filter_item, process_system_preds()
goes to fail_mem, where the allocated filter is freed.
However, this leads to memory leak of filter->filter_string and
filter->prog, which is allocated before and in process_preds().
This bug has been detected by kmemleak as well.
Fix this by changing kfree to __free_fiter.
unreferenced object 0xffff8880658007c0 (size 32):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
63 6f 6d 6d 6f 6e 5f 70 69 64 20 20 3e 20 31 30 common_pid > 10
00 00 00 00 00 00 00 00 65 73 00 00 00 00 00 00 ........es......
backtrace:
[<0000000067441602>] kstrdup+0x2d/0x60
[<00000000141cf7b7>] apply_subsystem_event_filter+0x378/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888060c22d00 (size 64):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 e8 d7 41 80 88 ff ff ...........A....
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000b8c1b109>] process_preds+0x243/0x1820
[<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888041d7e800 (size 512):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
70 bc 85 97 ff ff ff ff 0a 00 00 00 00 00 00 00 p...............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000001e04af34>] process_preds+0x71a/0x1820
[<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Link: http://lkml.kernel.org/r/20191211091258.11310-1-keitasuzuki.park@sslab.ics.keio.ac.jp
Cc: Ingo Molnar <mingo@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 404a3add43 ("tracing: Only add filter list when needed")
Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
2020-01-09 10:19:02 +01:00 |
| .. |
|
blktrace.c
|
for-4.19/post-20180822
|
2018-08-22 13:38:05 -07:00 |
|
bpf_trace.c
|
bpf: fix nested bpf tracepoints with per-cpu data
|
2019-07-03 13:14:48 +02:00 |
|
ftrace.c
|
ftrace: Get a reference counter for the trace_array on filter files
|
2019-10-17 13:45:40 -07:00 |
|
Kconfig
|
Masami found an off by one bug in the code that keeps "notrace" functions
|
2018-08-23 13:07:00 -07:00 |
|
Makefile
|
tracing: Allow gcov profiling on only ftrace subsystem
|
2018-08-21 09:11:49 -04:00 |
|
power-traces.c
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
|
2017-11-02 11:10:55 +01:00 |
|
preemptirq_delay_test.c
|
tracing: Use trace_clock_local() for looping in preemptirq_delay_test.c
|
2018-10-17 15:35:33 -04:00 |
|
ring_buffer.c
|
trace: Fix preempt_enable_no_resched() abuse
|
2019-05-02 09:58:54 +02:00 |
|
ring_buffer_benchmark.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
rpm-traces.c
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
|
2017-11-02 11:10:55 +01:00 |
|
trace.c
|
tracing: Fix lock inversion in trace_event_enable_tgid_record()
|
2020-01-09 10:19:02 +01:00 |
|
trace.h
|
tracing: Silence GCC 9 array bounds warning
|
2019-06-25 11:35:52 +08:00 |
|
trace_benchmark.c
|
rcu: Rename cond_resched_rcu_qs() to cond_resched_tasks_rcu_qs()
|
2018-05-15 10:27:29 -07:00 |
|
trace_benchmark.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |
|
trace_branch.c
|
Revert "x86/uaccess, ftrace: Fix ftrace_likely_update() vs. SMAP"
|
2019-07-03 13:14:41 +02:00 |
|
trace_clock.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
trace_entries.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |
|
trace_event_perf.c
|
tracing: Fix race in perf_trace_buf initialization
|
2019-10-29 09:20:03 +01:00 |
|
trace_events.c
|
tracing: Fix lock inversion in trace_event_enable_tgid_record()
|
2020-01-09 10:19:02 +01:00 |
|
trace_events_filter.c
|
tracing: Avoid memory leak in process_system_preds()
|
2020-01-09 10:19:02 +01:00 |
|
trace_events_filter_test.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |
|
trace_events_hist.c
|
tracing: Lock event_mutex before synth_event_mutex
|
2019-12-05 09:19:49 +01:00 |
|
trace_events_trigger.c
|
tracing: Fix memory leak in set_trigger_filter()
|
2018-12-19 19:19:52 +01:00 |
|
trace_export.c
|
tracing: Add trigger file for trace_markers tracefs/ftrace/print
|
2018-05-29 08:28:53 -04:00 |
|
trace_functions.c
|
tracing: Update stack trace skipping for ORC unwinder
|
2018-01-23 15:57:00 -05:00 |
|
trace_functions_graph.c
|
tracing/fgraph: Fix set_graph_function from showing interrupts
|
2018-12-08 12:59:07 +01:00 |
|
trace_hwlat.c
|
tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency
|
2019-10-17 13:45:39 -07:00 |
|
trace_irqsoff.c
|
tracing/fgraph: Fix set_graph_function from showing interrupts
|
2018-12-08 12:59:07 +01:00 |
|
trace_kdb.c
|
tracing: Silence GCC 9 array bounds warning
|
2019-06-25 11:35:52 +08:00 |
|
trace_kprobe.c
|
tracing/kprobe: Check whether the non-suffixed symbol is notrace
|
2019-12-31 16:36:02 +01:00 |
|
trace_kprobe_selftest.c
|
selftest/ftrace: Move kprobe selftest function to separate compile unit
|
2018-07-30 18:41:04 -04:00 |
|
trace_kprobe_selftest.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |
|
trace_mmiotrace.c
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
|
2017-11-02 11:10:55 +01:00 |
|
trace_nop.c
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
|
2017-11-02 11:10:55 +01:00 |
|
trace_output.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
trace_output.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |
|
trace_preemptirq.c
|
tracing: More reverting of "tracing: Centralize preemptirq tracepoints and unify their usage"
|
2018-08-10 15:12:00 -04:00 |
|
trace_printk.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
trace_probe.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
trace_probe.h
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
trace_sched_switch.c
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
|
2017-11-02 11:10:55 +01:00 |
|
trace_sched_wakeup.c
|
tracing/fgraph: Fix set_graph_function from showing interrupts
|
2018-12-08 12:59:07 +01:00 |
|
trace_selftest.c
|
Tracing updates for 4.15:
|
2017-11-17 14:58:01 -08:00 |
|
trace_selftest_dynamic.c
|
ftrace: Mark function tracer test functions noinline/noclone
|
2018-01-23 15:57:29 -05:00 |
|
trace_seq.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
trace_stack.c
|
tracing: Fix the file mode of stack tracer
|
2018-05-03 11:58:05 -04:00 |
|
trace_stat.c
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
|
2017-11-02 11:10:55 +01:00 |
|
trace_stat.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |
|
trace_syscalls.c
|
Tracing updates for 4.15:
|
2017-11-17 14:58:01 -08:00 |
|
trace_uprobe.c
|
tracing/uprobes: Fix output for multiple string arguments
|
2019-02-20 10:25:48 +01:00 |
|
tracing_map.c
|
tracing: Add SPDX License format tags to tracing files
|
2018-08-16 19:08:06 -04:00 |
|
tracing_map.h
|
tracing: Fix SPDX format headers to use C++ style comments
|
2018-08-16 19:08:06 -04:00 |