mirror-linux/tools/testing/selftests/user_events
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
..
Makefile selftests: user_events: Fix incorrect kernel headers search path 2023-03-10 09:34:17 +01:00
dyn_test.c
ftrace_test.c tracing/user_events: Ensure write index cannot be negative 2023-05-11 23:03:32 +09:00
perf_test.c tracing/user_events: Use bits vs bytes for enabled status page data 2022-09-29 10:17:37 -04:00
settings