From: Andrew Fenton <andrew.fenton@grapheneos.org>
To: bpf@vger.kernel.org
Subject: [QUESTION] BPF_F_NO_PREALLOC safety
Date: Wed, 1 Jul 2026 18:50:59 -0400 [thread overview]
Message-ID: <akWZ07aL4-Qclm_P@acomputer.local> (raw)
On review of BPF_F_NO_PREALLOC, it has a history of causing crashes and bugs through deadlock and memory allocator corruption.
The git history shows that initially it was possible to shoot oneself in the foot with this flag, but then check_map_prog_compatibility() was updated to restrict using it in unsafe ways. Since bpf_mem_alloc was introduced, it appears these restrictions have been dropped.
Can I conclude that this flag is now safe to use in all contexts and that, aside from the obvious resource (memory, performance) costs, a preallocated and dynamically-allocated hash map are equivalent in terms of behavior and safety? If not, can I rely on the kernel to prevent me from using this flag in an unsafe way?
Thanks.
reply other threads:[~2026-07-01 22:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=akWZ07aL4-Qclm_P@acomputer.local \
--to=andrew.fenton@grapheneos.org \
--cc=bpf@vger.kernel.org \
/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