All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: chenyuan_fl@163.com
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/3] selftests/bpf: Add ARRAY map type to token tests that use struct_ops global data
Date: Thu, 04 Jun 2026 03:25:07 +0000	[thread overview]
Message-ID: <20260604032507.6E0F71F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260604031033.806727-3-chenyuan_fl@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch introduces a test logic asymmetry by adding `BPF_MAP_TYPE_ARRAY` to the positive test `obj_priv_btf_success` but omitting it from the paired negative test `obj_priv_btf_fail`.
--

commit 86da58cc137440e9870bfb020bfbb8bab233e69a
Author: Yuan Chen <chenyuan@kylinos.cn>

selftests/bpf: Add ARRAY map type to token tests that use struct_ops global data

This commit adds BPF_MAP_TYPE_ARRAY to the allowed map types for the token
permissions of three positive subtests: obj_priv_btf_success,
obj_priv_implicit_token, and obj_priv_implicit_token_envvar. This allows
their skeletons to successfully load since they require ARRAY maps for global
data.

> diff --git a/tools/testing/selftests/bpf/prog_tests/token.c b/tools/testing/selftests/bpf/prog_tests/token.c
> index f2f5d36ae00a4..1812de87bedb8 100644
> --- a/tools/testing/selftests/bpf/prog_tests/token.c
> +++ b/tools/testing/selftests/bpf/prog_tests/token.c
> @@ -1214,7 +1214,7 @@ void serial_test_token(void)
>  		struct bpffs_opts opts = {
>  			/* allow BTF loading */
>  			.cmds = bit(BPF_BTF_LOAD) | bit(BPF_MAP_CREATE) | bit(BPF_PROG_LOAD),
> -			.maps = bit(BPF_MAP_TYPE_STRUCT_OPS),
> +			.maps = bit(BPF_MAP_TYPE_STRUCT_OPS) | bit(BPF_MAP_TYPE_ARRAY),

[Severity: Medium]
Should the negative test obj_priv_btf_fail also receive this update to its
map permissions?

Looking at obj_priv_btf_fail() earlier in the file, it is designed to verify
that lacking BPF_BTF_LOAD properly prevents BTF loading. It currently uses
only bit(BPF_MAP_TYPE_STRUCT_OPS) for its map permissions.

If a kernel regression incorrectly allowed BTF loading to bypass the token
restrictions, wouldn't obj_priv_btf_fail still fail during map creation
because it lacks BPF_MAP_TYPE_ARRAY, thereby silently masking the BTF load
enforcement regression?

>  			.progs = bit(BPF_PROG_TYPE_STRUCT_OPS),
>  			.attachs = ~0ULL,
>  		};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260604031033.806727-1-chenyuan_fl@163.com?part=2

  reply	other threads:[~2026-06-04  3:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  3:16 [PATCH] selftests/bpf: fix token tests for bpf_object__prepare() probe_loading chenyuan_fl
2026-05-29  3:39 ` sashiko-bot
2026-05-29  3:57 ` bot+bpf-ci
2026-06-04  3:10 ` [PATCH bpf-next v2 0/3] libbpf: fix implicit BPF token handling in loading and feature probes chenyuan_fl
2026-06-04  3:10   ` [PATCH bpf-next v2 1/3] libbpf: Skip bpf_object__probe_loading() when BPF token is in use chenyuan_fl
2026-06-04  4:05     ` bot+bpf-ci
2026-06-04 11:16     ` Mykyta Yatsenko
2026-06-08 18:17       ` Andrii Nakryiko
2026-06-09 13:11         ` [PATCH bpf] " chenyuan_fl
2026-06-09 13:35           ` Mykyta Yatsenko
2026-06-09 13:42           ` bot+bpf-ci
2026-06-04  3:10   ` [PATCH bpf-next v2 2/3] selftests/bpf: Add ARRAY map type to token tests that use struct_ops global data chenyuan_fl
2026-06-04  3:25     ` sashiko-bot [this message]
2026-06-08 18:14     ` Andrii Nakryiko
2026-06-04  3:10   ` [PATCH bpf-next v2 3/3] libbpf: fix feature probe failures for implicit BPF tokens chenyuan_fl
2026-06-04  3:27     ` sashiko-bot
2026-06-04  4:05     ` bot+bpf-ci
2026-06-04 14:40     ` Mykyta Yatsenko
2026-06-08 18:18       ` Andrii Nakryiko
2026-06-10 14:50   ` [PATCH bpf-next v3 0/2] libbpf: fix implicit BPF token feature probe failures chenyuan_fl
2026-06-10 14:50     ` [PATCH bpf-next v3 1/2] libbpf: Skip bpf_object__probe_loading() when BPF token is in use chenyuan_fl
2026-06-10 16:30       ` bot+bpf-ci
2026-06-10 14:50     ` [PATCH bpf-next v3 2/2] libbpf: fetch probeable prog type from token for feature probes chenyuan_fl
2026-06-10 15:04       ` sashiko-bot
2026-06-10 16:30       ` bot+bpf-ci

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=20260604032507.6E0F71F0089A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenyuan_fl@163.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.