klp_shadow_alloc(9)
β¨ NAME β¨
okay bestie, this page is all about klp_shadow_alloc from the Kernel API Manual, and she is literally here to allocate and add a new shadow variable. main character energy fr fr π
πΈ SYNOPSIS πΈ
void * klp_shadow_alloc (void *obj , unsigned long id , size_t size ,
gfp_t gfp_flags , klp_shadow_ctor_t ctor , void *ctor_data );
π ARGUMENTS π
objβ pointer to parent object. literally the parent object pointer, no cap.idβ data identifier. the id for the data, bestie.sizeβ size of attached data. how big the attached data is.gfp_flagsβ GFP mask for allocation. the GFP mask used for allocation.ctorβ custom constructor to initialize the shadow data (optional). optional, but she can initialize the shadow data.ctor_dataβ pointer to any data needed byctor(optional). optional pointer to whatever datactorneeds.
π¦ DESCRIPTION π¦
okay so what does she actually do? She allocates size bytes for new shadow variable data using gfp_flags. The data are zeroed by default, and then they are further initialized by the ctor function if it is not NULL. The new shadow variable is then added to the global hashtable. iconic behavior, honestly β¨
π¨ If an existing<obj, id>shadow variable can be found, this routine will issue aWARN, exit early and returnNULL. not a drill, bestie β duplicate vibes get the warning treatment and aNULL.
This function guarantees that the constructor function is called only when the variable did not exist before. The cost is that ctor is called in atomic context under a spin lock. that's the tradeoff, so pls respect it π
π RETURN π
the shadow variable data element, and NULL on duplicate or failure. that's the whole return vibe, periodt π
π SEE ALSO π
- Kernel file
./kernel/livepatch/shadow.c - Shadow variable API concurrency notes:(9)
struct klp_shadow(9)klp_shadow_match(9)klp_shadow_get(9)klp_shadow_get_or_alloc(9)klp_shadow_free(9)klp_shadow_free_all(9)
cute sign-off time π this page is giving ./kernel/livepatch source/version energy, dated October 2026, and the manual page is klp_shadow_alloc(9). stay slay, bestie ππ«Ά
π¦ 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