From: Khawar Ahemad <ahemadkhawar123@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org, jiayuan.chen@linux.dev
Subject: Re: [PATCH bpf-next v6 1/4] bpf: Add a sleepable page allocator for map memory
Date: Tue, 25 Aug 2026 15:52:15 +0530 [thread overview]
Message-ID: <20260825102215.83662-1-ahemadkhawar123@gmail.com> (raw)
In-Reply-To: <20260825094955.83240-2-ahemadkhawar123@gmail.com>
Hi,
Thanks for the careful review. After tracing the call path in full,
this finding is a false positive. Here is the evidence:
alloc_pages_nolock() is implemented as alloc_frozen_pages_nolock_noprof()
in mm/page_alloc.c. Regardless of which gfp_flags the caller passes, the
implementation unconditionally ORs in __GFP_ZERO before calling
get_page_from_freelist():
/* mm/page_alloc.c, alloc_frozen_pages_nolock_noprof() */
gfp_t alloc_gfp = __GFP_NOWARN | __GFP_ZERO | __GFP_NOMEMALLOC | __GFP_COMP
| gfp_flags;
The comment at that exact site makes the intent explicit:
"Specify __GFP_ZERO to make sure that call to kmsan_alloc_page() below
is safe in any context. Also zeroing the page is mandatory for
BPF use cases."
So even though __bpf_alloc_page() passes only __GFP_ACCOUNT to
alloc_pages_nolock(), the allocator enforces __GFP_ZERO unconditionally.
The returned page is always zeroed before being handed to the caller.
There is no path through which uninitialized kernel memory can be mapped
into a BPF arena.
The API documentation in include/linux/gfp.h also states that
__GFP_ACCOUNT is the only caller-supplied flag alloc_pages_nolock()
accepts, precisely because the implementation controls all others itself.
No code change is needed.
Khawar Ahemad <ahemadkhawar123@gmail.com>
next prev parent reply other threads:[~2026-08-25 10:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 9:49 [PATCH bpf-next v6 0/4] bpf: arena: handle memory.max on fault-in with reclaim/OOM Khawar Ahemad
2026-08-25 9:49 ` [PATCH bpf-next v6 1/4] bpf: Add a sleepable page allocator for map memory Khawar Ahemad
2026-08-25 10:11 ` sashiko-bot
2026-08-25 10:22 ` Khawar Ahemad [this message]
2026-08-25 10:32 ` bot+bpf-ci
2026-08-25 9:49 ` [PATCH bpf-next v6 2/4] bpf: arena: allocate the fault-in page outside the lock Khawar Ahemad
2026-08-25 10:32 ` bot+bpf-ci
2026-08-25 9:49 ` [PATCH bpf-next v6 3/4] selftests/bpf: Add read_cgroup_file() to cgroup_helpers Khawar Ahemad
2026-08-25 9:49 ` [PATCH bpf-next v6 4/4] selftests/bpf: Add a test for arena fault-in under memory.max Khawar Ahemad
2026-08-25 10:32 ` bot+bpf-ci
2026-08-25 10:43 ` Khawar Ahemad
2026-08-25 11:19 ` Jiayuan Chen
2026-08-25 12:23 ` Kumar Kartikeya Dwivedi
2026-08-25 11:28 ` Khawar Ahemad
2026-08-25 9:55 ` [PATCH bpf-next v6 0/4] bpf: arena: handle memory.max on fault-in with reclaim/OOM Jiayuan Chen
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=20260825102215.83662-1-ahemadkhawar123@gmail.com \
--to=ahemadkhawar123@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=jiayuan.chen@linux.dev \
--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.