[Gc] Allocating Executable Memory

Andrew Haley aph at redhat.com
Sat Jul 24 01:50:38 PDT 2010


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 writeable 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
writeable and executable permissions.

Andrew.


More information about the Gc mailing list