Re: SIGSEGV in LuaJIT 2.1 VM

  • From: Nick Zavaritsky <mejedi@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 26 Nov 2016 13:48:04 +0300


On 26 Nov 2016, at 09:00, Igor Ehrlich <igor.a.ehrlich@xxxxxxxxx> wrote:

The main problem with LuaJIT here is that it changes memory protection of the 
same page of memory due to trace additions/patches. I believe this could've 
been avoided even in LuaJIT by mcode management re-design 

It could be done without flipping memory protection, the same way LMDB does it. 
Basically, you write() the changes using the fd of the corresponding memory 
object.

I.e:

fd = shm_open(…);
mmap(…, fd, 0); /* map once with PROT_EXEC | PROT_READ */
/* later */
write(fd, …);

Other related posts: