dynamically written code problem
Tolga Dalman
ates100@web.de
Thu Oct 14 11:44:00 GMT 2004
hi,
On Mon, 11 Oct 2004 10:10:43 +0200 Paolo Bonzini <paolo.bonzini@polimi.it>
wrote:
> > > on my system, mmap is allocating in the 0x40000000 range, and malloc
> > > is allocating at the brk (around 0x08000000). Is this different when
> > > exec-shield is activated?
> >
> > Yes. mmap with PROT_EXEC set attempts to allocate as low as possible,
> > usually below the executable.
> > mmap without PROT_EXEC allocates as high as possible, below the stack.
>
> So at least my function does not lose execute protection if mmap was
> used with PROT_EXEC. Thank you very much,
the mprotect man-page says:
" POSIX.1b says that mprotect can be used only on regions of memory
obtained from mmap(2)."
is there a way to set the PROT_EXEC flag on arbitrary malloc'ed space ? at
least, using mprotect is (currently) not POSIX conforming.
regards,
Tolga Dalman
More information about the Gcc
mailing list