is_kfence_address(9)
β¨ 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:
kfence_alloc_pool_and_metadata(9)kfence_init(9)kfence_shutdown_cache(9)kfence_alloc(9)kfence_ksize(9)kfence_object_start(9)__kfence_free(9)kfence_free(9)kfence_handle_page_fault(9)__kfence_obj_info(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms