BPF List
 help / color / mirror / Atom feed
* [QUESTION] BPF_F_NO_PREALLOC safety
@ 2026-07-01 22:50 Andrew Fenton
  0 siblings, 0 replies; only message in thread
From: Andrew Fenton @ 2026-07-01 22:50 UTC (permalink / raw)
  To: bpf

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-01 22:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 22:50 [QUESTION] BPF_F_NO_PREALLOC safety Andrew Fenton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox