linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* JIT emulator needs
@ 2007-06-08  6:35 Albert Cahalan
  2007-06-08  7:09 ` Eric Dumazet
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Albert Cahalan @ 2007-06-08  6:35 UTC (permalink / raw)
  To: linux-kernel

Right now, Linux isn't all that friendly to JIT emulators.
Here are the problems and suggestions to improve the situation.

There is an SE Linux execmem restriction that enforces W^X.
Assuming you don't wish to just disable SE Linux, there are
two ugly ways around the problem. You can mmap a file twice,
or you can abuse SysV shared memory. The mmap method requires
that you know of a filesystem mounted rw,exec where you can
write a very large temporary file. This arbitrary filesystem,
rather than swap space, will be the backing store. The SysV
shared memory method requires an undocumented flag and is
subject to some annoying size limits. Both methods create
objects that will fail to be deleted if the program dies
before marking the objects for deletion.

Processors often have annoying limits on the immediate values
in instructions. An x86 or x86_64 JIT can go a bit faster if
all allocations are kept to the low 2 GB of address space.
There are also reasons for a 32bit-to-x86_64 JIT to chose
a nearly arbitrary 2 GB region that lies above 4 GB.
Other archs have other limits, such as 32 MB or 256 MB.

Sometimes it is very helpful to have the read/write mapping
be a fixed offset from the read/exec mapping. A power of 2
can be especially desirable.

Emulators often need a cheap way to change page permissions.
One VMA per page is no good. Besides taking up space and making
many things generally slower, having one VMA per page causes
a huge performance loss for snapshot roll-back operations.
Just tearing down all those VMAs takes a good while.

Additions to better support JIT emulators:

a. sysctl to set IPC_RMID by default
b. shmget() flag to set IPC_RMID by default
c. open() flag to unlink a file before returning the fd
d. mremap() flag to always keep the old mapping
e. mremap() flag to get a read/write mapping of a read/exec one
f. mremap() flag to get a read/exec mapping of a read/write one
g. mremap() flag to make the 5th arg (new addr) be the upper limit
h. 6-bit wide mremap() "flag" to set the upper limit above given base
i. support the prot argument to remap_file_pages
j. a documented way (madvise?) to punch same-VMA zero-page holes

^ permalink raw reply	[flat|nested] 28+ messages in thread
[parent not found: <8tGiE-2Hv-1@gated-at.bofh.it>]

end of thread, other threads:[~2007-06-24  4:13 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-08  6:35 JIT emulator needs Albert Cahalan
2007-06-08  7:09 ` Eric Dumazet
2007-06-09  4:12   ` Albert Cahalan
2007-06-08 11:10 ` Alan Cox
2007-06-08 16:35   ` Nicholas Miell
2007-06-09  5:17   ` Albert Cahalan
2007-06-09 20:00 ` H. Peter Anvin
2007-06-19 15:08 ` William Lee Irwin III
2007-06-20  3:16   ` Albert Cahalan
2007-06-20 16:01     ` William Lee Irwin III
2007-06-20 16:37       ` H. Peter Anvin
2007-06-20 17:54         ` William Lee Irwin III
2007-06-20 18:23           ` H. Peter Anvin
2007-06-20 18:25         ` Albert Cahalan
2007-06-20 18:51           ` H. Peter Anvin
2007-06-21  3:21             ` Albert Cahalan
2007-06-21  3:32               ` H. Peter Anvin
2007-06-21  7:38                 ` Albert Cahalan
2007-06-20 18:43       ` Albert Cahalan
2007-06-23  3:52   ` Kyle Moffett
2007-06-24  4:14     ` William Lee Irwin III
2007-06-21 17:44 ` Arjan van de Ven
2007-06-22  5:56   ` Albert Cahalan
2007-06-22 13:43     ` Arjan van de Ven
2007-06-22 14:32       ` Albert Cahalan
2007-06-22 14:42         ` Arjan van de Ven
2007-06-23  2:30           ` Albert Cahalan
     [not found] <8tGiE-2Hv-1@gated-at.bofh.it>
     [not found] ` <8xNvm-2Tw-29@gated-at.bofh.it>
     [not found]   ` <8xYTM-3So-13@gated-at.bofh.it>
2007-06-21 11:08     ` Bodo Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).