BPF List
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Masoud Aghasi <maghasi@disroot.org>, bpf@vger.kernel.org
Cc: andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
	daniel@iogearbox.net, memxor@gmail.com, martin.lau@linux.dev,
	song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
	emil@etsalapatis.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH v2 1/2] bpf: Fix incorrect handling of user flags by percpu map updates
Date: Thu, 1 Oct 2026 23:16:37 +0800	[thread overview]
Message-ID: <bd1e4297-347f-4f0c-a1aa-9a750e3e353b@linux.dev> (raw)
In-Reply-To: <20260930135753.1063495-2-maghasi@disroot.org>

Hi Masoud,

Thanks for the fix.

Pls add target tree in subject, like
[PATCH bpf v3 ...] bpf: ...

On 2026/9/30 21:57, Masoud Aghasi wrote:
> For BPF_MAP_TYPE_PERCPU_HASH map, htab_map_check_update_flags() and
> check_flags() are not considering the possibility of a combination of
> (BPF_NOEXIST, BPF_EXIST) flags with (BPF_F_CPU, BPF_F_ALL_CPUS) flags.
> This causes the (BPF_NOEXIST, BPF_EXIST) flags to lose their effect.
> 
> For example, when using (BPF_F_CPU | BPF_EXIST) flag combination
> with bpf_map_update_elem() on a BPF_MAP_TYPE_PERCPU_HASH map, the
> BPF_EXIST flag does not prevent new insertions as expected.
> 
> Also for BPF_MAP_TYPE_PERCPU_ARRAY map, using the (BPF_F_ALL_CPUS |
> BPF_EXIST) flag combination with bpf_map_update_elem() results in an
> incorrect EINVAL error response, even though the flag combination is
> valid.
> 
> This patch fixes the bug by adding proper flag validations and checks.
> 
> Fixes: c6936161fd55 ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_hash and lru_percpu_hash maps")
> Fixes: 8eb76cb03f0f ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_array maps")

I'd like to split this patch into two patches: one for lru_/percpu_hash
maps, another one for percpu_array maps.

Is there similar issue to percpu_cgroup_storage maps?

Thanks,
Leon

> [...]

  reply	other threads:[~2026-10-01 15:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 13:57 [PATCH v2 0/2] bpf: Fix incorrect handling of user flags by percpu map updates Masoud Aghasi
2026-09-30 13:57 ` [PATCH v2 1/2] " Masoud Aghasi
2026-10-01 15:16   ` Leon Hwang [this message]
2026-10-02  5:34     ` Masoud Aghasi
2026-09-30 13:57 ` [PATCH v2 2/2] selftests/bpf: add test for percpu map flags combination Masoud Aghasi
2026-09-30 14:42   ` bot+bpf-ci
2026-10-01 15:17   ` Leon Hwang
2026-10-02  5:36     ` Masoud Aghasi
2026-10-01 15:37   ` Alexei Starovoitov
2026-10-02  5:45     ` 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=bd1e4297-347f-4f0c-a1aa-9a750e3e353b@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=maghasi@disroot.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