Re[2]: [Gc] Allocating Executable Memory

Ivan Maidanski ivmai at mail.ru
Sat Jul 24 03:04:58 PDT 2010


Hi!

Okey. Another patch is needed which adjust the method how mmaping is done.

If I understand correctly, we just need to duplicate all relevant mmap and munmap calls (RW + E), right?
If yes, we also need some config option to enable this feature (otherwise retain old behavior).
Probably, we don't need to turn it on on Solaris.

Hans -
what do you think?

Noah -
it would be nice if you write this patch too (but after i commit the previous one)

Sat, 24 Jul 2010 09:50:38 +0100 Andrew Haley <aph at redhat.com>:

> On 07/23/2010 07:39 PM, Ivan Maidanski wrote:
> > Hello!
> > 
> > I like the idea.
> > I don't mind adding this feature in this release (probably Hans wouldn't neither since the added coded is small and easily verifiable).
> > 
> > The API should be:
> > - GC_set_pages_executable(int) // non-zero means executable
> > - GC_get_pages_executable() // returns non-zero if it is allowed to execute code in allocated memory 
> > 
> > NO_EXECUTE_PERMISSION controls the initial value only.
> > 
> > If you'd like to add it, I expect you'll provide the patch against the current CVS.
> > 
> > 
> > Fri, 23 Jul 2010 13:28:17 -0400 Noah Lavine <noah.b.lavine at gmail.com>:
> > 
> >> Hello GC Developers,
> >>
> >> I am writing with a feature request for the next version of your library.
> >>
> >> I am working on adding JIT compilation support to GNU Guile (a Scheme
> >> implementation), which uses this library for garbage collection. In
> >> order to make GC work, we'll need to allocate executable memory.
> 
> I think you'll find this problematic in practice, at least on
> GNU/Linux.  Some distributions forbid the allocation of memory that is
> mapped writable and executable, and I think the number of such
> distributions will increase over time.  On such systems Java is marked
> with a special file attribute, and that attribute is writeable only by
> root.
> 
> The way around this is supposed to be to map pages twice, with
> writable and executable permissions.
> 
> Andrew.
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/



More information about the Gc mailing list