What I know or, understand the mechanic:
I know that ARM based Apple Silicon(I call it M1 in following) doesn't allow applications apply RWX memorys, so that v8 flag the codespace with kNoAccessWillJitLater, in which way when calling mmap(), the MAP_JIT bit is set, so that compiler can switch the memory between RW and RX. I try to borrow the method in my own project, so I change the code in v8/src/base/page-allocator.cc:47, where restrict the flag only work in M1 environment.
There are only two places where JitLater is used as param:
v8/src/utils/allocation.cc:221
v8/src/heap/code-range.cc:365
and both of them call page_allocator->AllocatePages()
but PageAllocator is a class with 5 different subclass, since in v8/src/base/page-allocator.cc v8 block the JitLater in not-M1 system(I remove the block, it is not its fault, I also change the logic where judging access in platform-posix.cc GetFlagsForMemoryPermisson()), I thought it is where the call really goes.
And I write my code in v8/scr/base/platform/platform-posix.cc(I develop in linux), and listen in linux kernel, expecting browser make mmap() request with flag which has MAP_JIT bit, but no answer is got.
Potential answer: the caller is caling with other classes but not subclass in src/base/page-allocator, but i figure this deeper need lots of time.
Hope someone can help me with this problem, after removing two bypassing about kNoAccessWillJitLater, why cant see my change in kernel log?
P.S. not sys/mman.h and MAP_JIT fault, i test it with fixed bit.