Message ID | 20220316014841.2255248-1-kafai@fb.com (mailing list archive) |
---|---|
Headers | show |
Series | Remove libcap dependency from bpf selftests | expand |
On Tue, Mar 15, 2022 at 6:48 PM Martin KaFai Lau <kafai@fb.com> wrote: > > After upgrading to the newer libcap (>= 2.60), > the libcap commit aca076443591 ("Make cap_t operations thread safe.") > added a "__u8 mutex;" to the "struct _cap_struct". It caused a few byte > shift that breaks the assumption made in the "struct libcap" definition > in test_verifier.c. > > This set is to remove the libcap dependency from the bpf selftests. > > Martin KaFai Lau (3): > bpf: selftests: Add helpers to directly use the capget and capset > syscall > bpf: selftests: Remove libcap usage from test_verifier > bpf: selftests: Remove libcap usage from test_progs > Love the clean up and dropping the dependency on libcap! But it currently breaks CI, probably because of missing CAP_BPF definitions due to old system headers. Let's add #ifndef CAP_BPF/#define CAP_BPF XXX/#endif guards for newer capabilities to make it work in CI as well? [0] https://github.com/kernel-patches/bpf/runs/5563642266?check_suite_focus=true > tools/testing/selftests/bpf/Makefile | 8 +- > tools/testing/selftests/bpf/cap_helpers.c | 68 ++++++++++++++ > tools/testing/selftests/bpf/cap_helpers.h | 10 +++ > .../selftests/bpf/prog_tests/bind_perm.c | 45 ++-------- > tools/testing/selftests/bpf/test_verifier.c | 89 ++++++------------- > 5 files changed, 118 insertions(+), 102 deletions(-) > create mode 100644 tools/testing/selftests/bpf/cap_helpers.c > create mode 100644 tools/testing/selftests/bpf/cap_helpers.h > > -- > 2.30.2 >
Martin KaFai Lau wrote: > After upgrading to the newer libcap (>= 2.60), > the libcap commit aca076443591 ("Make cap_t operations thread safe.") > added a "__u8 mutex;" to the "struct _cap_struct". It caused a few byte > shift that breaks the assumption made in the "struct libcap" definition > in test_verifier.c. > > This set is to remove the libcap dependency from the bpf selftests. > > Martin KaFai Lau (3): > bpf: selftests: Add helpers to directly use the capget and capset > syscall > bpf: selftests: Remove libcap usage from test_verifier > bpf: selftests: Remove libcap usage from test_progs > > tools/testing/selftests/bpf/Makefile | 8 +- > tools/testing/selftests/bpf/cap_helpers.c | 68 ++++++++++++++ > tools/testing/selftests/bpf/cap_helpers.h | 10 +++ > .../selftests/bpf/prog_tests/bind_perm.c | 45 ++-------- > tools/testing/selftests/bpf/test_verifier.c | 89 ++++++------------- > 5 files changed, 118 insertions(+), 102 deletions(-) > create mode 100644 tools/testing/selftests/bpf/cap_helpers.c > create mode 100644 tools/testing/selftests/bpf/cap_helpers.h > > -- > 2.30.2 > For the series, Acked-by: John Fastabend <john.fastabend@gmail.com>
On Tue, Mar 15, 2022 at 10:36:48PM -0700, Andrii Nakryiko wrote: > On Tue, Mar 15, 2022 at 6:48 PM Martin KaFai Lau <kafai@fb.com> wrote: > > > > After upgrading to the newer libcap (>= 2.60), > > the libcap commit aca076443591 ("Make cap_t operations thread safe.") > > added a "__u8 mutex;" to the "struct _cap_struct". It caused a few byte > > shift that breaks the assumption made in the "struct libcap" definition > > in test_verifier.c. > > > > This set is to remove the libcap dependency from the bpf selftests. > > > > Martin KaFai Lau (3): > > bpf: selftests: Add helpers to directly use the capget and capset > > syscall > > bpf: selftests: Remove libcap usage from test_verifier > > bpf: selftests: Remove libcap usage from test_progs > > > > Love the clean up and dropping the dependency on libcap! But it > currently breaks CI, probably because of missing CAP_BPF definitions > due to old system headers. Let's add #ifndef CAP_BPF/#define CAP_BPF > XXX/#endif guards for newer capabilities to make it work in CI as > well? will spin v2. Thanks everyone for the review !