From mboxrd@z Thu Jan 1 00:00:00 1970 From: lars@nocrew.org (Lars Brinkhoff) Date: Mon, 27 Nov 2017 18:30:03 +0000 Subject: [TUHS] Harvard and Von Neumann Architectures and Unix In-Reply-To: (Lawrence Stewart's message of "Mon, 27 Nov 2017 13:21:25 -0500") References: <20171127161141.2C9E318C08F@mercury.lcs.mit.edu> <20171127165046.GD3430@mcvoy.com> Message-ID: <7wtvxf7exg.fsf@junk.nocrew.org> Lawrence Stewart wrote: > 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.