On 2017, Nov 27, at 12:08 PM, Clem Cole <clemc@ccc.com> wrote:

SPICE2 does the same sort of thing (in semi-portable Fortran-IV)

On Mon, Nov 27, 2017 at 11:50 AM, Larry McVoy <lm@mcvoy.com> wrote:
On Mon, Nov 27, 2017 at 11:11:41AM -0500, Noel Chiappa wrote:
>     > From: Doug McIlroy
>
>     > But if that had been in D space, it couldn't have been executed.
>
> Along those lines, I was wondering about modern OS's, which I gather for
> security reasons prevent execution of data, and prevent writing to code.
>
> 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.

Isn't that how dtrace works?


In POSIX systems, the mprotect(2) syscall can set execute permissions.