ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.480 by root, Fri Jun 25 01:13:21 2021 UTC vs.
Revision 1.481 by root, Thu Aug 19 22:43:02 2021 UTC

3623 save = POPs; save_ptr = SvPVbyte (save, save_len); 3623 save = POPs; save_ptr = SvPVbyte (save, save_len);
3624 load = POPs; load_ptr = SvPVbyte (load, load_len); 3624 load = POPs; load_ptr = SvPVbyte (load, load_len);
3625 3625
3626 map_len = load_len + save_len + 16; 3626 map_len = load_len + save_len + 16;
3627 3627
3628 map_base = mmap (0, map_len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
3629
3630 if (map_base == (char *)MAP_FAILED)
3631 map_base = mmap (0, map_len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 3628 map_base = mmap (0, map_len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
3632 3629
3633 assert (("Coro: unable to mmap jit code page, cannot continue.", map_base != (char *)MAP_FAILED)); 3630 assert (("Coro: unable to mmap jit code page, cannot continue.", map_base != (char *)MAP_FAILED));
3634 3631
3635 load_perl_slots = (load_save_perl_slots_type)map_base; 3632 load_perl_slots = (load_save_perl_slots_type)map_base;
3636 memcpy (map_base, load_ptr, load_len); 3633 memcpy (load_perl_slots, load_ptr, load_len);
3637 3634
3638 map_base += (load_len + 15) & ~15;
3639
3640 save_perl_slots = (load_save_perl_slots_type)map_base; 3635 save_perl_slots = (load_save_perl_slots_type)(map_base + ((load_len + 15) & ~15));
3641 memcpy (map_base, save_ptr, save_len); 3636 memcpy (save_perl_slots, save_ptr, save_len);
3642 3637
3643 /* we are good citizens and try to make the page read-only, so the evil evil */ 3638 /* we are good citizens and try to make the page read-only, so the evil evil */
3644 /* hackers might have it a bit more difficult */ 3639 /* hackers might have it a bit more difficult */
3640 /* we do this in two steps, to potentially appease some security frameworks */
3641 mprotect (map_base, map_len, PROT_READ);
3645 mprotect (map_base, map_len, PROT_READ | PROT_EXEC); 3642 mprotect (map_base, map_len, PROT_READ | PROT_EXEC);
3646 3643
3647 PUTBACK; 3644 PUTBACK;
3648 eval_pv ("undef &Coro::State::_jit", 1); 3645 eval_pv ("undef &Coro::State::_jit", 1);
3649} 3646}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines