sram_exec_copy(9)
π§ 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β thestruct gen_poolyou retrieved that is part of this sram, iykyk π«Άdstβ destination address for the copy, and it must be insidepool(no sneaking out, bestie π)srcβ source address for the data to copy β¨sizeβ size of copy to perform, which starting fromdst, must reside inpoolπ―
π 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
- 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