Re: Executing from dynamically allocated memory

=?UTF-8?B?U8OpYmFzdGllbiBGcmlja2Vy?= <sebastien.fricker@gmail.com>
Sat, 12 Oct 2013 11:52:11 +0200

          From comp.compilers

Related articles
Executing from dynamically allocated memory news@fx32.iad.highwinds-media.com (news) (2013-10-12)
Re: Executing from dynamically allocated memory james.harris.1@gmail.com (James Harris) (2013-10-12)
Re: Executing from dynamically allocated memory sebastien.fricker@gmail.com (=?UTF-8?B?U8OpYmFzdGllbiBGcmlja2Vy?=) (2013-10-12)
Re: Executing from dynamically allocated memory chakaram@auth.gr (2013-10-12)
Re: Executing from dynamically allocated memory blog@rivadpm.com (Alex McDonald) (2013-10-12)
Re: Executing from dynamically allocated memory sandmann@cs.au.dk (2013-10-12)
Re: Executing from dynamically allocated memory jkallup@web.de (Jens Kallup) (2013-10-13)
| List of all articles for this month |
From: =?UTF-8?B?U8OpYmFzdGllbiBGcmlja2Vy?= <sebastien.fricker@gmail.com>
Newsgroups: comp.compilers
Date: Sat, 12 Oct 2013 11:52:11 +0200
Organization: Compilers Central
References: 13-10-004
Keywords: architecture, code
Posted-Date: 12 Oct 2013 14:52:41 EDT

On 12.10.13 02:05, news wrote:
> In the past, I've malloc'd memory, written machine instructions into it,
> and called the function I built there. ...


> Now it was a year or three ago that this worked. Has Linux changed in
> this respect? Is there something new I have to do to allocate executable
> writable memory for this purpose?
>
> Or might there be something even weirder going on?
>
> -- hendrik
>
> [ Sounds like the NX bit. See http://en.wikipedia.org/wiki/NX_bit#Linux -John]


Hendrik,
this does not wonder me that it does not work anymore.
In 2003, I was working on the ARM-Linux kernel and I could see that more
and more the MMU protection bit get used principally to avoid the
possibility to misuse buffer-overflow.


But did you have a look on mmap()? (man mmap)
There is a flag PROT_EXEC. I guess this should permit to create a memory
area on which you can execute code.


SC)bastien



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.