sram_exec_copy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🧚 sram_exec_copy(9) β€” the Kernel API Manual glow-up πŸ’…

okay so bestie, welcome to the Kernel API Manual entry for sram_exec_copy β€” and no cap, this one is a whole vibe. it's the function that lets your sram driver be the main character in charge of protect-exec pools. let's get into it πŸ’–


✨ NAME ✨

sram_exec_copy β€” copy data to a protected executable region of sram πŸŽ€


🌸 SYNOPSIS 🌸

void * sram_exec_copy (struct gen_pool *pool , void *dst , void *src ,
size_t size );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • pool β€” the struct gen_pool you retrieved that is part of this sram, iykyk 🫢
  • dst β€” destination address for the copy, and it must be inside pool (no sneaking out, bestie πŸ’€)
  • src β€” source address for the data to copy ✨
  • size β€” size of copy to perform, which starting from dst, must reside in pool 🎯

πŸ’œ RETURN πŸ’œ

the address for copied data that can safely be called through a function pointer πŸŽ‰ …or NULL if there's a problem 😭 (sad, but at least it tells you).


πŸ”₯ DESCRIPTION πŸ”₯

this helper function lets the sram driver act as the central control location of protect-exec pools πŸ’… and those are literally normal sram pools, but they're always set read-only and executable β€” except when data is being copied to them, at which point they get flipped to read-write non-executable. the whole point? making sure no memory is writeable and executable at the same time. periodt. πŸ›‘

this region must be page-aligned, and that's checked during probe β€” otherwise page attribute manipulation would not be possible πŸ™ˆ. also, care must be taken to only call the returned address, because dst address is not guaranteed to be safely callable. the way that matters, okay? ⚠️


⭐ NOTE ⭐

this function uses the fncpy macro to move code to the executable region πŸ‘‘. some architectures have strict requirements for relocating executable code, so fncpy is a macro that must be defined by any arch making use of this functionality, and it guarantees a safe copy of exec data and returns a safe address that can be called as a C function pointer 🧠✨. iconic behaviour honestly.


🌈 SEE ALSO 🌈

  • Kernel file ./drivers/misc/sram-exec.c β€” go read it fr fr πŸ“–

that's the whole page bestie, you ate it up πŸ“

mwah πŸ’‹ β€” this came from ./drivers/misc, dated October 2026, and it's the sram_exec_copy(9) entry in the Kernel API Manual. archive it in your brain, no cap πŸŽ€βœ¨

πŸ“¦ where this page comes from