klp_shadow_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 by ctor (optional). optional pointer to whatever data ctor needs.

πŸ¦‹ 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 a WARN, exit early and return NULL. not a drill, bestie β€” duplicate vibes get the warning treatment and a NULL.

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 🌈


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