execmem_alloc_rw(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ 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 type get 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:

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