Commit e0c8a7e7 authored by Jordan Rife's avatar Jordan Rife Committed by Martin KaFai Lau

selftests/bpf: Add kernel socket operation tests

This patch creates two sets of sock_ops that call out to the SYSCALL
hooks in the sock_addr_kern BPF program and uses them to construct
test cases for the range of supported operations (kernel_connect(),
kernel_bind(), kernel_sendms(), sock_sendmsg(), kernel_getsockname(),
kenel_getpeername()). This ensures that these interact with BPF sockaddr
hooks as intended.

Beyond this it also ensures that these operations do not modify their
address parameter, providing regression coverage for the issues
addressed by this set of patches:

- commit 0bdf3993("net: Avoid address overwrite in kernel_connect")
- commit 86a7e0b6("net: prevent rewrite of msg_name in sock_sendmsg()")
- commit c889a99a("net: prevent address rewrite in kernel_bind()")
- commit 01b2885d("net: Save and restore msg_namelen in sock_sendmsg")
Signed-off-by: default avatarJordan Rife <jrife@google.com>
Link: https://lore.kernel.org/r/20240429214529.2644801-7-jrife@google.comSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 524e05ac
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment