execmem_alloc_rw(9)
π execmem_alloc_rw(9) β like, the whole manual page, bestie π
Okay so picture this: you're deep in kernel land, it's giving execmem_alloc_rw, section 9 of the kernel API manual, and she is literally the girl who hands you writable executable memory. Buckle up, we're doing this together π
β¨ SYNOPSIS β¨
void * execmem_alloc_rw (enum execmem_type type , size_t size );
That's her. That's the whole signature. Two arguments, one pointer back, no cap π«Ά
πΈ ARGUMENTS πΈ
typeβ the type of the allocation, bestie. Which flavour of execmem are we talking about? That's what this is.sizeβ how many bytes of memory you actually need. Yes, bytes. Count them. No vibes-based sizing π
π DESCRIPTION π
So what does she do? Glad you asked π
She allocates memory that's gonna contain executable code β either code that got generated, or code that was loaded from kernel modules. Both. Either. It's giving "executable code storage" main character energy β¨
She also allocates memory that'll contain data coupled with executable code β think data sections in kernel modules. The data and the code are, like, together π€
β οΈ Okay important, listen: she forces writable permissions on the allocated memory. Like, she just does it. And then? The caller is responsible for managing the permissions afterwards. That's you. You're the caller. It's your problem now, babe π Own it.
Now for the architecture tea β β two whole situations:
- Architectures that use ROX cache: the permissions get set to
R+W. Periodt. - Architectures that don't use ROX cache: the default permissions for
typeget used, as they must be writable. That's not a suggestion, that's just how it is π
π¦ RETURN π¦
She returns a pointer to the allocated memory... or NULL π (and yes, you should check. Always check. Bestie behaviour.)
π SEE ALSO π
Go read these, iykyk:
- Kernel file
./include/linux/execmem.h enum execmem_type(9)enum execmem_range_flags(9)execmem_fill_trapping_insns(9)execmem_restore_rox(9)struct execmem_range(9)struct execmem_info(9)execmem_arch_setup(9)execmem_alloc(9)execmem_free(9)execmem_vmap(9)execmem_is_rox(9)
Like a whole friend group of execmem functions, and honestly? Obsessed π§π
β¨ and that's the page!! β¨ shoutout to ./include/linux, dated October 2026, and this absolute icon execmem_alloc_rw(9) β slay, go allocate something, and don't forget to manage those permissions yourself πππ
π¦ 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