Skip to content

Commit 84cdbff

Browse files
TropicaoMartin KaFai Lau
authored andcommitted
selftests/bpf: add wrong type test to cgroup dev
Current cgroup_dev test mostly tests that device operation is accepted or refused base on passed major/minor (and so, any operation performed during test involves only char device) Add a small subtest ensuring that the device type passed to bpf program allows it to take decisions as well. Reviewed-by: Alan Maguire <[email protected]> Acked-by: Stanislav Fomichev <[email protected]> Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent d83d823 commit 84cdbff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/bpf/prog_tests/cgroup_dev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ void test_cgroup_dev(void)
114114
if (test__start_subtest("deny-write"))
115115
test_write("/dev/zero", buf, TEST_BUFFER_SIZE, -1, EPERM);
116116

117+
if (test__start_subtest("deny-mknod-wrong-type"))
118+
test_mknod("/dev/test_dev_cgroup_block", S_IFBLK, 1, 3, -1,
119+
EPERM);
120+
117121
cleanup_progs:
118122
dev_cgroup__destroy(skel);
119123
cleanup_cgroup:

0 commit comments

Comments
 (0)