]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/bpf: add tests verifying unprivileged bpf behaviour
authorAlan Maguire <alan.maguire@oracle.com>
Thu, 19 May 2022 14:25:34 +0000 (15:25 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 21 May 2022 02:54:34 +0000 (19:54 -0700)
commit90a039fd19fc35d03a74ce2973992c878546cb20
treecede8e9b69fef859b496bd610e1836a688c41617
parentc8644cd0efe719608ddcb341bcf087d4bc0bf6b8
selftests/bpf: add tests verifying unprivileged bpf behaviour

tests load/attach bpf prog with maps, perfbuf and ringbuf, pinning
them.  Then effective caps are dropped and we verify we can

- pick up the pin
- create ringbuf/perfbuf
- get ringbuf/perfbuf events, carry out map update, lookup and delete
- create a link

Negative testing also ensures

- BPF prog load fails
- BPF map create fails
- get fd by id fails
- get next id fails
- query fails
- BTF load fails

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/1652970334-30510-3-git-send-email-alan.maguire@oracle.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/unpriv_bpf_disabled.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_unpriv_bpf_disabled.c [new file with mode: 0644]