BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v13 8/8] selftests/bpf: Add tests to verify map create failure log
Date: Wed, 13 May 2026 00:33:57 +0000	[thread overview]
Message-ID: <20260513003358.55836C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511152817.89191-9-leon.hwang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The tests `test_invalid_numa_node` and `test_invalid_token_fd` use the hardcoded value `0xFF` (255) to trigger validation failures, which can cause spurious test failures on certain systems.
--

commit 31093136dd05cf604e6a2e0d0a470807567ed4a7
Author: Leon Hwang <leon.hwang@linux.dev>

selftests/bpf: Add tests to verify map create failure log

This commit adds tests to verify that the kernel reports the expected error
messages and correct log_true_size when map creation fails.

> diff --git a/tools/testing/selftests/bpf/prog_tests/map_init.c b/tools/testing/selftests/bpf/prog_tests/map_init.c
> index 14a31109dd0e0..5c61c8e373065 100644
> --- a/tools/testing/selftests/bpf/prog_tests/map_init.c
> +++ b/tools/testing/selftests/bpf/prog_tests/map_init.c

[ ... ]

> +static void test_invalid_numa_node(void)
> +{
> +	const char *msg = "Invalid numa_node.\n";
> +	LIBBPF_OPTS(bpf_map_create_opts, opts,
> +		    .map_flags = BPF_F_NUMA_NODE,
> +		    .numa_node = 0xFF,

Is it possible for this test to fail spuriously on large systems? If the
test runs on a machine with 256 or more NUMA nodes where node 255 is
online, the kernel validation will pass. 

The map creation might then fail for another reason, skipping the expected
log message and causing the test to fail.

Would a value like 0xFFFFFFFE (avoiding NUMA_NO_NODE) be more reliable to
ensure it exceeds nr_node_ids?

> +	);
> +
> +	test_map_create_array(&opts, msg);
> +}

[ ... ]

> +static void test_invalid_token_fd(void)
> +{
> +	const char *msg = "Invalid map_token_fd.\n";
> +	LIBBPF_OPTS(bpf_map_create_opts, opts,
> +		    .map_flags = BPF_F_TOKEN_FD,
> +		    .token_fd = 0xFF,

Could this also cause an unexpected test failure if file descriptor 255
happens to be an open BPF token in the test runner? 

It looks like test_invalid_btf_fd uses -1 to guarantee an invalid file
descriptor. Does it make sense to use -1 here as well?

> +	);
> +
> +	test_map_create_array(&opts, msg);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260511152817.89191-1-leon.hwang@linux.dev?part=8

  reply	other threads:[~2026-05-13  0:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 15:28 [PATCH bpf-next v13 0/8] bpf: Extend BPF syscall with common attributes support Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 1/8] " Leon Hwang
2026-05-11 16:19   ` bot+bpf-ci
2026-05-11 16:53     ` Alexei Starovoitov
2026-05-12  2:41       ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 2/8] libbpf: Add support for extended BPF syscall Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 3/8] bpf: Refactor reporting log_true_size for prog_load Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 4/8] bpf: Add syscall common attributes support " Leon Hwang
2026-05-12 22:18   ` sashiko-bot
2026-05-13 10:44     ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 5/8] bpf: Add syscall common attributes support for btf_load Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 6/8] bpf: Add syscall common attributes support for map_create Leon Hwang
2026-05-11 16:19   ` bot+bpf-ci
2026-05-11 17:07     ` Alexei Starovoitov
2026-05-12  2:47       ` Leon Hwang
2026-05-12 23:36   ` sashiko-bot
2026-05-13 10:45     ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 7/8] libbpf: " Leon Hwang
2026-05-12 23:56   ` sashiko-bot
2026-05-13 10:46     ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 8/8] selftests/bpf: Add tests to verify map create failure log Leon Hwang
2026-05-13  0:33   ` sashiko-bot [this message]
2026-05-13 10:47     ` Leon Hwang

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=20260513003358.55836C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leon.hwang@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox