linux-stable/tools/testing
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
..
crypto/chacha20-s390 tools/testing/crypto: Use vzalloc instead of vmalloc+memset 2022-07-05 14:46:36 +02:00
cxl tools/testing/cxl: Add a single-port host-bridge regression config 2022-11-04 16:01:24 -07:00
fault-injection
ktest ktest.pl: Add RUN_TIMEOUT option with default unlimited 2023-03-10 09:34:27 +01:00
kunit kunit: tool: Don't download risc-v opensbi firmware with wget 2022-10-07 10:16:28 -06:00
memblock Revert "mm: Always release pages to the buddy allocator in memblock_free_late()." 2023-02-22 12:59:50 +01:00
nvdimm ndtest: Cleanup all of blk namespace specific code 2022-07-12 17:57:55 -07:00
radix-tree maple_tree: fix write memory barrier of nodes once dead for RCU mode 2023-04-20 12:35:12 +02:00
scatterlist
selftests tracing/user_events: Ensure write index cannot be negative 2023-05-11 23:03:32 +09:00
vsock vsock_test: POLLIN + SO_RCVLOWAT test 2022-08-23 10:43:12 +02:00