Ticket #18 (closed patch: fixed)
Jit code buffers need to be allocated via mmap()
Reported by: | Infinoid | Owned by: | Infinoid |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | none | Version: | |
Severity: | none | Keywords: | JIT patch |
Cc: | Language: | ||
Patch status: | applied | Platform: |
Description
Currently on linux x86, jit code buffers are allocated from the heap. On certain platforms and under certain conditions, the heap is not executable. This results in a segfault immediately upon attempting to execute some JIT code. We are currently able to reproduce this on feather3, when executing tene's build from within a screen session (don't ask).
Parrot does call mprotect() in an attempt to set the right permissions on the buffer. However, the mprotect manpage on my linux box says that POSIX mprotect behavior is undefined when called on a non-mmaped buffer. So, it looks like we need to switch mem_alloc_executable()/mem_free_executable()/mem_realloc_executable() over to using mmap.