From: sashiko-bot@kernel.org
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/7] bpf: Drop redundant hash_buf from map_get_hash operation
Date: Mon, 01 Jun 2026 15:29:30 +0000 [thread overview]
Message-ID: <20260601152930.F0E021F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260601150248.394863-3-daniel@iogearbox.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Computing the SHA-256 hash of a large frozen array map without scheduling points can cause a prolonged CPU stall (soft lockup).
--
commit 5b323404e84282b52180b843142a5d52b5becb22
Author: Daniel Borkmann <daniel@iogearbox.net>
bpf: Drop redundant hash_buf from map_get_hash operation
This commit simplifies the map_get_hash operation by dropping the unused
hash_buf_size argument and removing a redundant self-copy in
array_map_get_hash. The bpf_map_get_info_by_fd function is updated to invoke
it without passing the buffer.
> diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
> --- a/kernel/bpf/arraymap.c
> +++ b/kernel/bpf/arraymap.c
[ ... ]
> -static int array_map_get_hash(struct bpf_map *map, u32 hash_buf_size,
> - void *hash_buf)
> +static int array_map_get_hash(struct bpf_map *map)
> {
> struct bpf_array *array = container_of(map, struct bpf_array, map);
>
> sha256(array->value, (u64)array->elem_size * array->map.max_entries,
> - hash_buf);
> - memcpy(array->map.sha, hash_buf, sizeof(array->map.sha));
> + array->map.sha);
[Severity: High]
This isn't a bug introduced by this patch, but could this sha256 call cause
a soft lockup for very large array maps?
BPF array maps can be allocated with very large sizes. Since sha256 processes
the data sequentially without yielding, computing it over a gigabyte-sized
array might take seconds of uninterrupted CPU time.
Because bpf_map_get_info_by_fd unconditionally triggers this computation when
a user requests the map hash, is there a risk that this could be used to
repeatedly stall the CPU, leading to RCU stalls or soft lockup warnings?
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260601150248.394863-1-daniel@iogearbox.net?part=2
next prev parent reply other threads:[~2026-06-01 15:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 15:02 [PATCH bpf-next v2 0/7] More gen_loader fixes Daniel Borkmann
2026-06-01 15:02 ` [PATCH bpf-next v2 1/7] bpf: Reject exclusive maps as inner maps in map-in-map Daniel Borkmann
2026-06-01 15:18 ` sashiko-bot
2026-06-01 15:40 ` Daniel Borkmann
2026-06-01 15:02 ` [PATCH bpf-next v2 2/7] bpf: Drop redundant hash_buf from map_get_hash operation Daniel Borkmann
2026-06-01 15:29 ` sashiko-bot [this message]
2026-06-01 15:02 ` [PATCH bpf-next v2 3/7] libbpf: Reject non-exclusive metadata maps in the signed loader Daniel Borkmann
2026-06-01 16:03 ` bot+bpf-ci
2026-06-01 15:02 ` [PATCH bpf-next v2 4/7] libbpf: Skip initial_value override on signed loaders Daniel Borkmann
2026-06-01 15:48 ` bot+bpf-ci
2026-06-01 15:58 ` sashiko-bot
2026-06-01 15:02 ` [PATCH bpf-next v2 5/7] libbpf: Skip max_entries " Daniel Borkmann
2026-06-01 15:02 ` [PATCH bpf-next v2 6/7] selftests/bpf: Adjust verifier_map_ptr for the map's excl field Daniel Borkmann
2026-06-01 16:20 ` sashiko-bot
2026-06-01 15:02 ` [PATCH bpf-next v2 7/7] selftests/bpf: Test that exclusive maps are rejected in map-in-map Daniel Borkmann
2026-06-02 1:40 ` [PATCH bpf-next v2 0/7] More gen_loader fixes patchwork-bot+netdevbpf
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=20260601152930.F0E021F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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.