RFR: 8282475: SafeFetch should not rely on existence of Thread::current

Johannes Bechberger duke at openjdk.java.net
Mon Mar 7 12:34:04 UTC 2022


On Mon, 7 Mar 2022 12:16:02 GMT, David Holmes <dholmes at openjdk.org> wrote:

> I agree that safeFetch should not have become dependent on Thread::current existing, but I have to wonder whether we can just skip the WX code if there is no current thread? If the thread is not attached to the VM then what does it even mean to manipulate the WX state of an unknown thread?

The OS thread is always known. The WXMode is unrelated to Thread object. The WXMode is set for an OS thread to allow pages to be either writable or executable (needed for code generation).

> That aside, with this change I think we can move the conditional WX code out of the shared os.hpp and bury it down in os_bsd_aarch64.hpp where it actually belongs.

May I ask how that would affect the code that uses the methods (includes, ...)?

> I'd even like to see threadWXSetters.inline.hpp moved to being in src/os_cpu/bsd_aarch64/ if feasible - I'm not sure what include would be needed for the callsites to function - os.hpp I presume?

I don't know whether this is enough.

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

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


More information about the serviceability-dev mailing list