From: sashiko-bot@kernel.org
To: chenyuan_fl@163.com
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 2/2] selftests/bpf: Add regression test for queue/stack map size limit
Date: Fri, 07 Aug 2026 02:13:58 +0000 [thread overview]
Message-ID: <20260807021358.D4BAB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807020548.1376979-3-chenyuan_fl@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Multi-line comment opening `/*` is not on its own line.
--
--- Patch [2]: [PATCH 2/2] selftests/bpf: Add regression test for queue/stack map size limit ---
commit e79d16bed784907a39f11792c9c1497efb8fd26f
Author: Yuan Chen <chenyuan@kylinos.cn>
selftests/bpf: Add regression test for queue/stack map size limit
This commit adds a regression test to verify that queue and stack maps reject
creation if their element storage size exceeds U32_MAX bytes. It tests both
queue and stack maps with an oversized configuration, ensuring they fail with
-E2BIG, and also verifies that a normal-sized map is successfully created.
> diff --git a/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c b/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c
> index 41441325e1794..6f8ac285e7196 100644
> --- a/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c
> +++ b/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c
[ ... ]
> @@ -101,8 +101,42 @@ static void test_queue_stack_map_by_type(int type)
> bpf_object__close(obj);
> }
>
> +static void test_queue_stack_map_alloc_check(void)
> +{
> + LIBBPF_OPTS(bpf_map_create_opts, opts);
> + const __u32 big_value = 1 << 20; /* 1MB */
> + int fd, saved_errno;
> +
> + /* Regression test for the u32 index overflow in queue/stack maps:
[Severity: Low]
This isn't a bug, but should this multi-line comment follow the BPF subsystem
comment style by placing the opening /* on its own line?
> + * a map whose element storage (max_entries * value_size) exceeds
> + * U32_MAX bytes must be rejected at creation time, otherwise the
> + * u32 head/tail index multiplication wraps and push/peek/pop
> + * address the wrong element. 8192 * 1MB = 8GB > U32_MAX.
> + */
> + fd = bpf_map_create(BPF_MAP_TYPE_QUEUE, NULL, 0, big_value, 8192, &opts);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807020548.1376979-1-chenyuan_fl@163.com?part=2
prev parent reply other threads:[~2026-08-07 2:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 2:05 [PATCH bpf 0/2] bpf: Fix queue/stack map u32 index overflow chenyuan_fl
2026-08-07 2:05 ` [PATCH 1/2] " chenyuan_fl
2026-08-07 2:15 ` sashiko-bot
2026-08-07 2:05 ` [PATCH 2/2] selftests/bpf: Add regression test for queue/stack map size limit chenyuan_fl
2026-08-07 2:13 ` sashiko-bot [this message]
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=20260807021358.D4BAB1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox