Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #989

Re: Executing from dynamically allocated memory

From Sébastien Fricker <sebastien.fricker@gmail.com>
Newsgroups comp.compilers
Subject Re: Executing from dynamically allocated memory
Date 2013-10-12 11:52 +0200
Organization Compilers Central
Message-ID <13-10-006@comp.compilers> (permalink)
References <13-10-004@comp.compilers>

Show all headers | View raw


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

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Executing from dynamically allocated memory "news" <news@fx32.iad.highwinds-media.com> - 2013-10-12 00:05 +0000
  Re: Executing from dynamically allocated memory "James Harris" <james.harris.1@gmail.com> - 2013-10-12 10:10 +0100
  Re: Executing from dynamically allocated memory Sébastien Fricker <sebastien.fricker@gmail.com> - 2013-10-12 11:52 +0200
  Re: Executing from dynamically allocated memory chakaram@auth.gr - 2013-10-12 19:20 +0300
  Re: Executing from dynamically allocated memory Alex McDonald <blog@rivadpm.com> - 2013-10-12 11:12 -0700
  Re: Executing from dynamically allocated memory sandmann@cs.au.dk (Søren Sandmann) - 2013-10-12 20:58 +0200
  Re: Executing from dynamically allocated memory Jens Kallup <jkallup@web.de> - 2013-10-13 10:44 +0200

csiph-web