On Thu, 11 Nov 2021 18:07:37 GMT, Andrew Haley <a...@openjdk.org> wrote:

> > > Am I right is saying that for Macos, all generated code is remapped RO 
> > > before execution?
> > 
> > 
> > Ah, no, it seems the code cache is not RWX all the time as far as Java 
> > threads are concerned. The Macos/AArch64 code is strategically calling 
> > pthread_jit_write_protect_np at Java <-> JVM transition points.
> 
> And this requires magic kernel support. I did mention it to a kernel engineer 
> who wasn't very impressed, but I think it's pretty cool.

It's possible to emulate this to some extent with memory protection keys on 
POWER and (recent) x86. See `pkey_alloc`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6334

Reply via email to