mirror_ubuntu-kernels/tools/testing/selftests/user_events
Beau Belgrave cd98c93286 tracing/user_events: Ensure write index cannot be negative
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>
2023-04-25 21:03:46 -04:00
..
abi_test.c tracing/user_events: Add ABI self-test 2023-03-29 06:52:09 -04:00
dyn_test.c selftests: use canonical ftrace path 2023-03-29 06:52:07 -04:00
ftrace_test.c tracing/user_events: Ensure write index cannot be negative 2023-04-25 21:03:46 -04:00
Makefile tracing/user_events: Add ABI self-test 2023-03-29 06:52:09 -04:00
perf_test.c tracing/user_events: Update self-tests to write ABI 2023-03-29 06:52:08 -04:00
settings user_events: Add self-test for ftrace integration 2022-02-10 22:37:47 -05:00