linux-stable/tools
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
..
accounting
arch tools/x86/kcpuid: Fix avx512bw and avx512lvl fields in Fn00000007 2023-05-11 23:03:07 +09:00
bootconfig bootconfig: Fix testcase to increase max node 2023-03-30 12:49:07 +02:00
bpf bpftool: Fix bug for long instructions in program CFG dumps 2023-05-11 23:03:21 +09:00
build perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available 2022-10-25 17:40:48 -03:00
certs
cgroup iocost_monitor: reorder BlkgIterator 2022-09-23 16:57:10 -10:00
counter
debugging tools: Add new "test" taint to kernel-chktaint 2022-09-07 14:51:12 -06:00
edid
firewire
firmware
gpio tools: gpio: fix -c option of gpio-event-mon 2023-02-01 08:34:49 +01:00
hv tools: hv: kvp: remove unnecessary (void*) conversions 2022-09-05 16:55:20 +00:00
iio tools/iio/iio_utils:fix memory leak 2023-03-11 13:55:35 +01:00
include tools/nolibc: prevent gcc from making memset() loop over itself 2023-02-01 08:34:31 +01:00
io_uring
kvm/kvm_stat tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace 2022-11-09 12:26:52 -05:00
laptop
leds
lib libbpf: Fix ld_imm64 copy logic for ksym in light skeleton. 2023-05-11 23:03:18 +09:00
memory-model tools/memory-model: Clarify LKMM's limitations in litmus-tests.txt 2022-08-31 05:15:31 -07:00
objtool Revert "objtool: Support addition to set CFA base" 2023-05-11 23:03:32 +09:00
pci
pcmcia
perf perf stat: Fix counting when initial delay configured 2023-03-17 08:50:24 +01:00
power tools/power turbostat: fix decoding of HWP_STATUS 2023-04-06 12:10:41 +02:00
rcu
scripts
spi
testing tracing/user_events: Ensure write index cannot be negative 2023-05-11 23:03:32 +09:00
thermal
time
tracing tools/tracing/rtla: osnoise_hist: use total duration for average calculation 2023-03-10 09:33:26 +01:00
usb
verification rv/dot2c: Make automaton definition static 2022-10-20 16:02:45 -04:00
virtio tools/virtio: fix the vringh test for virtio ring changes 2023-02-22 12:59:42 +01:00
vm tools/mm/page_owner_sort.c: fix TGID output when cull=tg is used 2023-04-26 14:28:39 +02:00
wmi
Makefile