History log of /external/linux-kselftest/tools/testing/selftests/bpf/test_dev_cgroup.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
37f1ba0909dfa12c75f8e8ea7a2f01355ebd60f1 05-Nov-2017 Roman Gushchin <guro@fb.com> selftests/bpf: add a test for device cgroup controller

Add a test for device cgroup controller.

The test loads a simple bpf program which logs all
device access attempts using trace_printk() and forbids
all operations except operations with /dev/zero and
/dev/urandom.

Then the test creates and joins a test cgroup, and attaches
the bpf program to it.

Then it tries to perform some simple device operations
and checks the result:

create /dev/null (should fail)
create /dev/zero (should pass)
copy data from /dev/urandom to /dev/zero (should pass)
copy data from /dev/urandom to /dev/full (should fail)
copy data from /dev/random to /dev/zero (should fail)

Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
/external/linux-kselftest/tools/testing/selftests/bpf/test_dev_cgroup.c