execmem_restore_rox(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… execmem_restore_rox β€” like, the un-writable-ing function

okay bestie, buckle up, because this little cutie lives in the Kernel API Manual (execmem_restore_rox(9)) and it is genuinely one of the most straightforward glow-ups in the whole execmem friend group. no cap. 🫢


✨ SYNOPSIS ✨

int execmem_restore_rox (void *ptr , size_t size );

that's it. two args. she's low maintenance. πŸŽ€


🌸 ARGUMENTS 🌸

  • ptr β€” the address of the region you wanna remap, bestie. literally just where the thing starts. πŸ“
  • size β€” how big that region is, i.e. the size of the region to remap. don't skip this one, she matters. πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” this function restores read-only-execute permissions on the range [ptr, ptr + size) after that range was temporarily remapped as writable. yes, temporarily. we were just borrowing the write bit, we promise. πŸ™ˆ

it relies on the architecture implementation of set_memory_rox to restore the mapping, and it does that using large pages. iconic behaviour honestly. πŸ‘‘

so the vibe is: someone made it writable for a hot sec, did their little thing, and now execmem_restore_rox is here to put the ROX permissions back on like a bestie fixing your hair before a photo. πŸ“Έβœ¨


πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • a negative error code on failure 😭

like, that's it. binary vibes. either we slayed or we didn't.

ngl bestie, always check the return value. 0 is the green flag, anything negative is a red flag fr fr. 🚩

πŸ’œ SEE ALSO πŸ’œ

all the other execmem besties, in the Kernel file ./include/linux/execmem.h:

go read them. all of them. iykyk. πŸ“šπŸ’…


and that's the whole page, bestie β€” written under ./include/linux, dated October 2026, and honestly? she ate. 🌈⭐ bye pookie, go fix those permissions πŸ«ΆπŸ’–

πŸ“¦ where this page comes from