All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 6/7] selftests/bpf: Explicitly disable token in token/obj_priv_freplace_prog_fail test
Date: Wed, 25 Nov 2026 15:40:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-233665@kernel.org> (raw)
In-Reply-To: <20261125-bpf-relax-get-next-id-v1-6-49175227c8cf@toke.dk>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/bpf: char literal assigned to pointer in
  userns_obj_priv_freplace_setup()
--

commit 2c21fda1bda78f7e8ad66a69f75df48fbe870eed
Author: Toke Høiland-Jørgensen <toke@toke.dk>

selftests/bpf: Explicitly disable token in token/obj_priv_freplace_prog_fail test

This commit updates userns_obj_priv_freplace_setup() to take a boolean
flag controlling whether the BPF token is disabled for the freplace
program in the obj_priv_freplace_prog_fail test.

> diff --git a/tools/testing/selftests/bpf/prog_tests/token.c b/tools/testing/selftests/bpf/prog_tests/token.c
> index f2f5d36ae00a4..dcb5e9f2d61e2 100644
> --- a/tools/testing/selftests/bpf/prog_tests/token.c
> +++ b/tools/testing/selftests/bpf/prog_tests/token.c
> @@ -797,7 +797,7 @@ static int userns_obj_priv_prog(int mnt_fd, struct token_lsm *lsm_skel)
>  }
>  
>  static int userns_obj_priv_freplace_setup(int mnt_fd, struct priv_freplace_prog **fr_skel,
> -					  struct priv_prog **skel, int *tgt_fd)
> +					  struct priv_prog **skel, int *tgt_fd, bool fr_token)
>  {
>  	LIBBPF_OPTS(bpf_object_open_opts, opts);
>  	int err;
> @@ -813,6 +813,8 @@ static int userns_obj_priv_freplace_setup(int mnt_fd, struct priv_freplace_prog
>  	if (!ASSERT_OK(err, "priv_prog__load"))
>  		return -EINVAL;
>  
> +	if (!fr_token)
> +		opts.bpf_token_path = '\0';

[Severity: Medium]
Should opts.bpf_token_path be set to "" instead of '\0'?

opts.bpf_token_path is a const char *, so assigning the character constant
'\0' sets the pointer to NULL rather than an empty string.  Building with
Clang fails under -Werror,-Wnon-literal-null-conversion, and at runtime
bpf_object_prepare_token() checks for a non-NULL empty string
(obj->token_path && obj->token_path[0] == '\0') to skip token creation,
treating NULL as unspecified and falling back to the default bpffs path.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-bpf-relax-get-next-id-v1-0-49175227c8cf@toke.dk?part=6

  reply	other threads:[~2026-11-25 15:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 15:31 [PATCH bpf-next 0/7] Improvements to access module BTF with bpf_token Toke Høiland-Jørgensen
2026-11-25 15:31 ` [PATCH bpf-next 1/7] bpf: Relax BPF_*_GET_NEXT_ID permission checks to CAP_BPF and bpf_token Toke Høiland-Jørgensen
2026-11-25 15:31 ` [PATCH bpf-next 2/7] libbpf: Add bpf_*_get_next_id_opts() functions Toke Høiland-Jørgensen
2026-11-25 15:46   ` sashiko-bot
2026-11-26  9:48     ` Toke Høiland-Jørgensen
2026-11-25 15:31 ` [PATCH bpf-next 3/7] libbpf: Automatically set BPF_F_TOKEN_FD when getting BTF fd Toke Høiland-Jørgensen
2026-11-25 15:31 ` [PATCH bpf-next 4/7] libbpf: Move bpf_object_prepare_token() to object creation Toke Høiland-Jørgensen
2026-11-25 15:31 ` [PATCH bpf-next 5/7] libbpf: Pass in token_fd when iterating kernel BTF objects Toke Høiland-Jørgensen
2026-11-25 15:56   ` sashiko-bot
2026-11-25 15:31 ` [PATCH bpf-next 6/7] selftests/bpf: Explicitly disable token in token/obj_priv_freplace_prog_fail test Toke Høiland-Jørgensen
2026-11-25 15:40   ` sashiko-bot [this message]
2026-11-25 15:31 ` [PATCH bpf-next 7/7] selftests/bpf: Add test for attaching fentry to a module with bpf_token Toke Høiland-Jørgensen

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=sashiko-outbox-233665@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=toke@toke.dk \
    /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.