android_kernel_motorola_sm6375/kernel/trace
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Chen Zhongjin ac58b88ccb ftrace: Fix invalid address access in lookup_rec() when index is 0
commit ee92fa443358f4fc0017c1d0d325c27b37802504 upstream.

KASAN reported follow problem:

 BUG: KASAN: use-after-free in lookup_rec
 Read of size 8 at addr ffff000199270ff0 by task modprobe
 CPU: 2 Comm: modprobe
 Call trace:
  kasan_report
  __asan_load8
  lookup_rec
  ftrace_location
  arch_check_ftrace_location
  check_kprobe_address_safe
  register_kprobe

When checking pg->records[pg->index - 1].ip in lookup_rec(), it can get a
pg which is newly added to ftrace_pages_start in ftrace_process_locs().
Before the first pg->index++, index is 0 and accessing pg->records[-1].ip
will cause this problem.

Don't check the ip when pg->index is 0.

Link: https://lore.kernel.org/linux-trace-kernel/20230309080230.36064-1-chenzhongjin@huawei.com

Cc: stable@vger.kernel.org
Fixes: 9644302e33 ("ftrace: Speed up search by skipping pages by address")
Suggested-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-22 13:28:09 +01:00
..
blktrace.c blktrace: Fix output non-blktrace event when blk_classic option enabled 2023-01-18 11:41:13 +01:00
bpf_trace.c bpf: Skip task with pid=1 in send_signal_common() 2023-02-06 07:52:48 +01:00
fgraph.c
ftrace.c ftrace: Fix invalid address access in lookup_rec() when index is 0 2023-03-22 13:28:09 +01:00
ftrace_internal.h
Kconfig
Makefile
power-traces.c
preemptirq_delay_test.c
ring_buffer.c tracing: Add NULL checks for buffer in ring_buffer_free_read_page() 2023-03-11 16:44:13 +01:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw 2023-02-22 12:50:30 +01:00
trace.h tracing: Make sure trace_printk() can output as soon as it can be used 2023-02-06 07:52:43 +01:00
trace_benchmark.c
trace_benchmark.h
trace_branch.c
trace_clock.c
trace_dynevent.c tracing: Free buffers when a used dynamic event is removed 2022-12-08 11:23:04 +01:00
trace_dynevent.h
trace_entries.h
trace_event_perf.c
trace_events.c tracing: Free buffers when a used dynamic event is removed 2022-12-08 11:23:04 +01:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c tracing: Check field value in hist_field_name() 2023-03-22 13:28:08 +01:00
trace_events_trigger.c tracing: Dump stacktrace trigger to the corresponding instance 2022-04-27 13:50:45 +02:00
trace_export.c
trace_functions.c
trace_functions_graph.c
trace_hwlat.c
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c tracing: Fix return value of __setup handlers 2022-03-08 19:07:50 +01:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Make sure trace_printk() can output as soon as it can be used 2023-02-06 07:52:43 +01:00
trace_output.h
trace_preemptirq.c tracing: hold caller_addr to hardirq_{enable,disable}_ip 2022-09-28 11:03:57 +02:00
trace_printk.c
trace_probe.c tracing/probes: Have kprobes and uprobes use $COMM too 2022-08-25 11:18:39 +02:00
trace_probe.h
trace_probe_tmpl.h
trace_sched_switch.c
trace_sched_wakeup.c
trace_selftest.c
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c
trace_stat.c
trace_stat.h
trace_syscalls.c
trace_uprobe.c
tracing_map.c
tracing_map.h