]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: migrate cgroup sock create test for prohibiting sockets
authorDaniel T. Lee <danieltimlee@gmail.com>
Fri, 11 Oct 2024 04:48:45 +0000 (04:48 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 11 Oct 2024 16:51:31 +0000 (09:51 -0700)
commit64a4658d6f766ca058e28277a4c2743525d7dc26
tree80dc38cbce5cec629961a3d260e81ef4bcd4bea9
parentec6c4be073237814f4dd7f56ef72f08760cfaa90
selftests/bpf: migrate cgroup sock create test for prohibiting sockets

This patch continues the migration and removal process for cgroup
sock_create tests to selftests.

The test being migrated verifies the ability of cgroup BPF to block the
creation of specific types of sockets using a verdict. Specifically, the
test denies socket creation when the socket is of type AF_INET{6},
SOCK_DGRAM, and IPPROTO_ICMP{V6}. If the requested socket type matches
these attributes, the cgroup BPF verdict blocks the socket creation.

As with the previous commit, this test currently lacks coverage in
selftests, so this patch migrates the functionality into the sock_create
tests under selftests. This migration ensures that the socket creation
blocking behavior with cgroup bpf program is properly tested within the
selftest framework.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Link: https://lore.kernel.org/r/20241011044847.51584-3-danieltimlee@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
samples/bpf/Makefile
samples/bpf/sock_flags.bpf.c [deleted file]
samples/bpf/test_cgrp2_sock2.c [deleted file]
samples/bpf/test_cgrp2_sock2.sh [deleted file]
tools/testing/selftests/bpf/prog_tests/sock_create.c