is_kfence_address(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ is_kfence_address(9) ✨

ok so picture this: you're deep in the Kernel API Manual, section 9, and you find this little gem πŸ’– bestie, let me tell you about is_kfence_address β€” she's a tiny function with main character energy and she's here to save your heap from itself 🫢


🌸 NAME 🌸

is_kfence_address β€” check if an address belongs to the KFENCE pool πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

bool is_kfence_address (const void *addr );

like, yes, that's the whole thing. she's short. she's efficient. she's iconic ⭐


πŸ¦‹ ARGUMENTS πŸ¦‹

  • addr β€” the address you want to check, bestie. that's it. that's the argument. no cap πŸ”₯

🌈 RETURN 🌈

returns true or false, depending on whether the address is within the KFENCE object range ✨

literally just a vibe check for addresses. is she in the KFENCE zone or not? πŸ’€


πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea, and it's important tea πŸ“

KFENCE objects live in a separate page range and are not to be intermixed with regular heap objects. like, ever. (for example, KFENCE objects must never be added to the allocator freelists β€” not me stressing about this 😭).

if you fail to do that, it may and will result in heap corruptions. not "might". not "could". will. so yeah, is_kfence_address must be used to check whether an object requires specific handling πŸ”₯ this is not optional, bestie, this is the whole point πŸ‘‘

fr fr, this one is a correctness thing. treat her with respect πŸ™ˆ

🧚 NOTE 🧚

this function may be used in fast-paths and is performance critical πŸ‘‘

so future changes should take that into account. for instance, we want to avoid introducing another load, and therefore we need to keep KFENCE_POOL_SIZE a constant (until immediate patching support is added to the kernel) πŸ’…

like, she's on the hot path. don't bloat her. periodt ✨


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/kfence.h:

the whole kfence friend group, honestly. go say hi 🫢🌈


and that's the page, bestie!! πŸ’– this one's from ./include/linux and dated October 2026 β€” so like, mark your calendars, she's from the future πŸ•°οΈβœ¨ slay!! πŸŽ€πŸ’œ

πŸ“¦ where this page comes from