From: Masoud Aghasi <maghasi@disroot.org>
To: Leon Hwang <leon.hwang@linux.dev>, 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 bpf v4 1/3] bpf: Fix incorrect handling of user flags in bpf_percpu_array_update
Date: Mon, 5 Oct 2026 15:58:38 +0100 [thread overview]
Message-ID: <e9812369-5936-4c76-90eb-1c23858d2e64@disroot.org> (raw)
In-Reply-To: <7b661c7e-3d01-4361-8d0c-84c97866b404@linux.dev>
On 05/10/2026 04:10, Leon Hwang wrote:
> Hi Masoud,
>
> Please wait some time, say 24 hours, for human reviews before sending
> the next revision.
Hi Leon, noted. thanks for the review.
>
>> @@ -438,7 +438,8 @@ int bpf_percpu_array_update(struct bpf_map *map, void *key, void *value,
>> u32 size;
>> int cpu, off = 0;
>>
>> - if (unlikely((map_flags & BPF_F_LOCK) || (u32)map_flags > BPF_F_ALL_CPUS))
>> + if (unlikely((map_flags & BPF_EXIST) && (map_flags & BPF_NOEXIST)) ||
>> + unlikely((u32)map_flags & ~(BPF_EXIST | BPF_NOEXIST | BPF_F_CPU | BPF_F_ALL_CPUS)))
>
> Probably, we can add these two macros in include/linux/bpf.h.
>
> #define BPF_EXIST_FLAGS (BPF_EXIST | BPF_NOEXIST)
> #define BPF_CPU_FLAGS (BPF_F_CPU | BPF_F_ALL_CPUS)
>
> Then, this 'if' can be simplified to
>
> if (unlikely(((map_flags & BPF_EXIST_FLAGS) == BPF_EXIST_FLAGS) ||
> ((u32)map_flags & ~(BPF_EXIST_FLAGS | BPF_CPU_FLAGS)))
>
> Also simplify htab_map_check_update_flags() in the next patch by the
> same way.
>
> Thanks,
> Leon
Sounds good to me. I will apply it to the v5 if there are no objections.
next prev parent reply other threads:[~2026-10-05 14:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-04 11:10 [PATCH bpf v4 0/3] bpf: Fix incorrect handling of user flags by percpu map updates Masoud Aghasi
2026-10-04 11:10 ` [PATCH bpf v4 1/3] bpf: Fix incorrect handling of user flags in bpf_percpu_array_update Masoud Aghasi
2026-10-05 3:10 ` Leon Hwang
2026-10-05 14:58 ` Masoud Aghasi [this message]
2026-10-04 11:10 ` [PATCH bpf v4 2/3] bpf: Fix incorrect handling of user flags by percpu hash map updates Masoud Aghasi
2026-10-04 11:10 ` [PATCH bpf v4 3/3] selftests/bpf: add tests for percpu map flags combination Masoud Aghasi
2026-10-05 3:12 ` Leon Hwang
2026-10-05 15:19 ` Masoud Aghasi
2026-10-06 2:12 ` 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=e9812369-5936-4c76-90eb-1c23858d2e64@disroot.org \
--to=maghasi@disroot.org \
--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=leon.hwang@linux.dev \
--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