Commit 84cdbff4 authored by Alexis Lothoré (eBPF Foundation)'s avatar Alexis Lothoré (eBPF Foundation) Committed by Martin KaFai Lau

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: default avatarAlan Maguire <alan.maguire@oracle.com>
Acked-by: default avatarStanislav Fomichev <sdf@fomichev.me>
Signed-off-by: default avatarAlexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20240731-convert_dev_cgroup-v4-3-849425d90de6@bootlin.comSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent d83d8230
...@@ -114,6 +114,10 @@ void test_cgroup_dev(void) ...@@ -114,6 +114,10 @@ void test_cgroup_dev(void)
if (test__start_subtest("deny-write")) if (test__start_subtest("deny-write"))
test_write("/dev/zero", buf, TEST_BUFFER_SIZE, -1, EPERM); test_write("/dev/zero", buf, TEST_BUFFER_SIZE, -1, EPERM);
if (test__start_subtest("deny-mknod-wrong-type"))
test_mknod("/dev/test_dev_cgroup_block", S_IFBLK, 1, 3, -1,
EPERM);
cleanup_progs: cleanup_progs:
dev_cgroup__destroy(skel); dev_cgroup__destroy(skel);
cleanup_cgroup: cleanup_cgroup:
......
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