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: Jordan Rife <jrife@google.com> Link: https://lore.kernel.org/r/20240429214529.2644801-7-jrife@google.comSigned-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Showing
This diff is collapsed.
Please register or sign in to comment