BPF List
 help / color / mirror / Atom feed
From: Masoud Aghasi <maghasi@disroot.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Andrii Nakryiko <andrii@kernel.org>,
	Eduard <eddyz87@gmail.com>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	Brian Vazquez <brianvv@google.com>
Subject: Re: [PATCH v3] bpf: Fix u32 overflow issue in map batch operations
Date: Fri, 4 Sep 2026 14:19:50 +0100	[thread overview]
Message-ID: <322400e7-c708-4da4-a317-cbaaea62848d@disroot.org> (raw)
In-Reply-To: <CAADnVQLX5bjLTPm8Ch0wNuojHrKw6R5iJDBRsMJwrWMSupVwew@mail.gmail.com>

On 04/09/2026 05:45, Alexei Starovoitov wrote:
> On Thu, Sep 3, 2026 at 1:28 AM Masoud Aghasi <maghasi@disroot.org> wrote:
>>
>> Several map batch operation implementations such as
>> generic_map_lookup_batch() use calculations in the form of
>> "values + cp * map->value_size" to compute the desired userspace memory
>> address for reading or writing. This can overflow the u32 type
>> (the result of "cp * map->value_size") when the map size exceeds 4GB.
>>
>> generic_map_lookup_batch() may corrupt values for some keys in
>> userspace memory, and in some cases it mismatches values for some keys
>> while still reporting success.
> 
> without selftest I have to assume that this is AI hallucination.
> 
> pw-bot: cr

Thanks for the review.

I didn't found this bug using AI. I posted the sample program that
reproduces the issue in v1. The reason I didn't include a selftest is
that reproducing the issue requires 8GB+ memory allocation, which I
don't think is appropriate for the regular BPF selftest suite.

Personally, I'm not sure an opt-in test would provide much value as a
regression test, since it would not be exercised during the regular
selftest runs. However, I'm happy to add an opt-in EXTENDED selftest in
v4 (using TEST_GEN_PROGS_EXTENDED in Makefile), if you think retaining
an explicit reproducer in the kernel selftests is worthwhile.

  reply	other threads:[~2026-09-04 13:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 11:31 [PATCH] bpf: Fix u32 overflow issue in map batch operations Masoud Aghasi
2026-08-24 11:42 ` sashiko-bot
2026-08-25 10:21   ` Masoud Aghasi
2026-09-02 20:44     ` [PATCH v2] " Masoud Aghasi
2026-09-02 21:50       ` bot+bpf-ci
2026-09-03  8:27       ` [PATCH v3] " Masoud Aghasi
2026-09-03  8:45         ` sashiko-bot
2026-09-03 12:31           ` Masoud Aghasi
2026-09-04  4:45         ` Alexei Starovoitov
2026-09-04 13:19           ` Masoud Aghasi [this message]
2026-08-24 12:17 ` [PATCH] " bot+bpf-ci
2026-08-24 19:15 ` Masoud Aghasi

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=322400e7-c708-4da4-a317-cbaaea62848d@disroot.org \
    --to=maghasi@disroot.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brianvv@google.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@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