Noel Chiappa wrote:
Programs which emit these little 'custom
code fragments' (I prefer
that term, since they aren't really 'self-modifying code' - which I
define as 'a program which _changes_ _existing_ instructions) must
have some way of having a chunk of memory into which they can write,
but which can also be executed.
In POSIX systems, the mprotect(2) syscall can set execute permissions.
Or if a statically allocated space is ok, just set your pages to rwx in
the executable image file.