RE: [PATCH bpf-next 1/3] bpf: selftests: Add helpers to directly use the capget and capset syscall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
> 
> The bpf selftest usage only needs to enable and disable the effective
> caps of the running task.  It is easier to directly syscall the
> capget and capset instead.  It can also remove the libcap
> library dependency.
> 
> The cap_helpers.{c,h} is added.  One __u64 is used for all CAP_*
> bits instead of two __u32.
> 
> Signed-off-by: Martin KaFai Lau <kafai@xxxxxx>
> ---
>  tools/testing/selftests/bpf/cap_helpers.c | 68 +++++++++++++++++++++++
>  tools/testing/selftests/bpf/cap_helpers.h | 10 ++++
>  2 files changed, 78 insertions(+)
>  create mode 100644 tools/testing/selftests/bpf/cap_helpers.c
>  create mode 100644 tools/testing/selftests/bpf/cap_helpers.h
> 
> diff --git a/tools/testing/selftests/bpf/cap_helpers.c b/tools/testing/selftests/bpf/cap_helpers.c
> new file mode 100644
> index 000000000000..e83eab902657
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/cap_helpers.c

LGTM

Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux