diff options
author | Eduard Zingerman <eddyz87@gmail.com> | 2024-12-03 20:47:55 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-12-04 09:19:50 -0800 |
commit | adfdd9c68566120debc622712888c4d084539081 (patch) | |
tree | abf320babd02753d42a0bd842134705084f07686 /tools/perf/tests/shell/lib/perf_json_output_lint.py | |
parent | b0e66977dc072906bb76555fb1a64261d7f63d0f (diff) |
selftests/bpf: Introduce __caps_unpriv annotation for tests
Add a __caps_unpriv annotation so that tests requiring specific
capabilities while dropping the rest can conveniently specify them
during selftest declaration instead of munging with capabilities at
runtime from the testing binary.
While at it, let us convert test_verifier_mtu to use this new support
instead.
Since we do not want to include linux/capability.h, we only defined the
four main capabilities BPF subsystem deals with in bpf_misc.h for use in
tests. If the user passes a CAP_SYS_NICE or anything else that's not
defined in the header, capability parsing code will return a warning.
Also reject strtol returning 0. CAP_CHOWN = 0 but we'll never need to
use it, and strtol doesn't errno on failed conversion. Fail the test in
such a case.
The original diff for this idea is available at link [0].
[0]: https://lore.kernel.org/bpf/a1e48f5d9ae133e19adc6adf27e19d585e06bab4.camel@gmail.com
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
[ Kartikeya: rebase on bpf-next, add warn to parse_caps, convert test_verifier_mtu ]
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20241204044757.1483141-4-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/tests/shell/lib/perf_json_output_lint.py')
0 files changed, 0 insertions, 0 deletions