]> git.hungrycats.org Git - linux/commit
selftests/bpf: add test for bpf_msg_pop_data() overflow
authorSechang Lim <rhkrqnwk98@gmail.com>
Mon, 15 Jun 2026 02:19:59 +0000 (10:19 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 15 Jun 2026 04:30:21 +0000 (21:30 -0700)
commit70b139d0483cd42808326c36c4b63d5be4a3cccb
treeb0c88d547739abbb2cbc792edb146bd05712ff36
parenta48802fb2cd2d1e23651989f8ff4d15e9d5dad54
selftests/bpf: add test for bpf_msg_pop_data() overflow

Add a test in sockmap_basic.c that calls bpf_msg_pop_data() with a length
close to U32_MAX, which overflows the start + len bounds check. The sk_msg
program records the return value over a sendmsg and the test checks that
the call is rejected with -EINVAL.

Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://lore.kernel.org/r/20260615021959.140010-7-jiayuan.chen@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
tools/testing/selftests/bpf/progs/test_sockmap_msg_pop_data.c [new file with mode: 0644]