acrn-kernel/kernel/trace
Beau Belgrave 0489c2b2c3 tracing/user_events: Ensure write index cannot be negative
[ Upstream commit cd98c93286 ]

The write index indicates which event the data is for and accesses a
per-file array. The index is passed by user processes during write()
calls as the first 4 bytes. Ensure that it cannot be negative by
returning -EINVAL to prevent out of bounds accesses.

Update ftrace self-test to ensure this occurs properly.

Link: https://lkml.kernel.org/r/20230425225107.8525-2-beaub@linux.microsoft.com

Fixes: 7f5a08c79d ("user_events: Add minimal support for trace_event into ftrace")
Reported-by: Doug Cook <dcook@linux.microsoft.com>
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:03:32 +09:00
..
rv
Kconfig tracing: Fix complicated dependency of CONFIG_TRACER_MAX_TRACE 2023-01-07 11:11:48 +01:00
Makefile
blktrace.c trace/blktrace: fix memory leak with using debugfs_lookup() 2023-03-10 09:33:46 +01:00
bpf_trace.c bpf: Fix a possible task gone issue with bpf_send_signal[_thread]() helpers 2023-02-09 11:28:00 +01:00
bpf_trace.h
error_report-traces.c
fgraph.c
fprobe.c
ftrace.c ftrace: Fix issue that 'direct->addr' not restored in modify_ftrace_direct() 2023-04-13 16:55:32 +02:00
ftrace_internal.h
kprobe_event_gen_test.c tracing: Fix wrong return in kprobe_event_gen_test.c 2023-04-06 12:10:41 +02:00
pid_list.c
pid_list.h
power-traces.c
preemptirq_delay_test.c
rethook.c
ring_buffer.c ring-buffer: Sync IRQ works before buffer destruction 2023-05-11 23:03:02 +09:00
ring_buffer_benchmark.c
rpm-traces.c
synth_event_gen_test.c
trace.c tracing: Fix permissions for the buffer_percent file 2023-05-11 23:03:04 +09:00
trace.h tracing: Fix TASK_COMM_LEN in trace event format file 2023-02-14 19:11:54 +01:00
trace_benchmark.c
trace_benchmark.h
trace_boot.c
trace_branch.c
trace_clock.c
trace_dynevent.c
trace_dynevent.h
trace_entries.h
trace_eprobe.c tracing: Fix race where eprobes can be called before the event 2023-01-07 11:11:48 +01:00
trace_event_perf.c
trace_events.c tracing: Make trace_define_field_ext() static 2023-02-22 12:59:53 +01:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c tracing: Do not let histogram values have some modifiers 2023-04-06 12:10:36 +02:00
trace_events_inject.c
trace_events_synth.c tracing/synthetic: Make lastcmd_mutex static 2023-04-13 16:55:35 +02:00
trace_events_trigger.c
trace_events_user.c tracing/user_events: Ensure write index cannot be negative 2023-05-11 23:03:32 +09:00
trace_export.c tracing: Fix TASK_COMM_LEN in trace event format file 2023-02-14 19:11:54 +01:00
trace_functions.c
trace_functions_graph.c
trace_hwlat.c tracing/hwlat: Replace sched_setaffinity with set_cpus_allowed_ptr 2023-03-30 12:48:59 +02:00
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_osnoise.c tracing/osnoise: Fix notify new tracing_max_latency 2023-04-13 16:55:34 +02:00
trace_output.c tracing: Make sure trace_printk() can output as soon as it can be used 2023-02-01 08:34:37 +01:00
trace_output.h
trace_preemptirq.c
trace_printk.c
trace_probe.c tracing/probes: Handle system names with hyphens 2023-01-07 11:11:48 +01:00
trace_probe.h
trace_probe_kernel.h
trace_probe_tmpl.h
trace_recursion_record.c
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_synth.h
trace_syscalls.c
trace_uprobe.c
tracing_map.c
tracing_map.h