kfence_shutdown_cache(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to kfence_shutdown_cache(9) from the Kernel API Manual πŸŽ€ β€” it’s the page about handling shutdown_cache() for KFENCE objects, and honestly it’s giving β€œniche but crucial.” ✨

✨ NAME ✨

kfence_shutdown_cache β€” handle shutdown_cache() for KFENCE objects πŸ’…

🌸 SYNOPSIS 🌸

void kfence_shutdown_cache (struct kmem_cache *s );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • s β€” the cache being shut down. 🫢

πŸ’– DESCRIPTION πŸ’–

okay so, before shutting down a cache, one must ensure there are no remaining objects allocated from it. literally the vibe check. because KFENCE objects are not referenced from the cache directly, we need to check them here. πŸ’…

ngl, note that shutdown_cache is internal to SL*B, and kmem_cache_destroy does not return if allocated objects still exist: it prints an error message and simply aborts destruction of a cache, leaking memory. πŸ’€ so yeah, that’s the no-good outcome.

If the only such objects are KFENCE objects, we will not leak the entire cache, but instead try to provide more useful debug info by making allocated objects "zombie allocations". Objects may then still be used or freed (which is handled gracefully), but usage will result in showing KFENCE error reports which include stack traces to the user of the object, the original allocation site, and caller to shutdown_cache. 😭✨

🌈 SEE ALSO 🌈

Kernel file ./include/linux/kfence.h is in the group chat too, and the related squad is:


mwah πŸ’‹ β€” footer source/version: ./include/linux; date: October 2026. bestie out 🫢

πŸ“¦ where this page comes from