Matthew Flatt wrote:
>Since, as you note, units of JIT
>generation tend to be smaller than a page, this creates trouble if
>JITted code running in one thread is allocated on the same page as
>JITting in progress in another thread.

My guess is that from the point of view of security the proper way to
solve this would be either to synchronize access to the page between
the two threads and flip the writable/executable permissions depending
on which thread is currently locking the page, or have the two threads
never operate on the same page and switch a page's permission from
writable to executable and make it visible to the execution thread
only once the page is full of JITted code (simulating some kind of
page-by-page pipeline system between the two threads, instead of
sharing memory).  I have no idea how efficient or inefficient this
could be, it would depend a lot on the way in which the execution
thread follows the JITting thread around from page to page (since I
guess in general the code that the execution thread wants to execute
next is precisely the code that has just been JITted).

> * creating a temporary file F;
> * mapping a region of F to executable memory; and
> * mapping the same region of F to writable memory.
>So, write to the latter address, and the code at the former address
>changes. (At this point, I've definitely lost track of what problem
>"W^X" is supposed to solve.)

Aliasing memory pages is just a trick to work around the W^X requirement
without fixing the underlying problem...  See the last paragraph here:
https://marc.info/?l=openbsd-misc&m=145943630726937&w=2
It would make the code more complex without making anything better
from the point of security (as you note).  It's also a trick that
is visible to the kernel and I somehow doubt that kernels will keep
allowing this trick for ever.  In fact if I had to bet I'd say that
it'll be disallowed as soon as W^X becomes mandatory...

Philippe


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to