All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Martin KaFai Lau <kafai@fb.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com
Subject: RE: [PATCH bpf-next 1/3] bpf: selftests: Add helpers to directly use the capget and capset syscall
Date: Tue, 15 Mar 2022 23:17:23 -0700	[thread overview]
Message-ID: <623180f35efff_1761208fd@john.notmuch> (raw)
In-Reply-To: <20220316014847.2256135-1-kafai@fb.com>

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@fb.com>
> ---
>  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@gmail.com>

  reply	other threads:[~2022-03-16  6:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  1:48 [PATCH bpf-next 0/3] Remove libcap dependency from bpf selftests Martin KaFai Lau
2022-03-16  1:48 ` [PATCH bpf-next 1/3] bpf: selftests: Add helpers to directly use the capget and capset syscall Martin KaFai Lau
2022-03-16  6:17   ` John Fastabend [this message]
2022-03-16  1:48 ` [PATCH bpf-next 2/3] bpf: selftests: Remove libcap usage from test_verifier Martin KaFai Lau
2022-03-17  2:18   ` Shung-Hsi Yu
2022-03-17  7:04     ` Shung-Hsi Yu
2022-03-16  1:49 ` [PATCH bpf-next 3/3] bpf: selftests: Remove libcap usage from test_progs Martin KaFai Lau
2022-03-16 15:14   ` sdf
2022-03-16  5:36 ` [PATCH bpf-next 0/3] Remove libcap dependency from bpf selftests Andrii Nakryiko
2022-03-16 17:17   ` Martin KaFai Lau
2022-03-16  6:20 ` John Fastabend

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=623180f35efff_1761208fd@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.