RFR: 8328306: AArch64: MacOS lazy JIT "write xor execute" switching [v3]
Dean Long
dlong at openjdk.org
Tue Aug 19 00:15:42 UTC 2025
On Mon, 18 Aug 2025 15:49:15 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp line 249:
>>
>>> 247: // If we got a SIGBUS because we tried to write into the code
>>> 248: // cache, try enabling WXWrite mode.
>>> 249: if (sig == SIGBUS && pc != info->si_addr && CodeCache::contains(info->si_addr) && !CodeCache::contains(pc)) {
>>
>> Only the hotspot code should write into the code cache, right? A more secure alternative would be then to use `os::address_is_in_vm()`. That compares against the text segment of the libjvm. Prevents accidental misdiagnosis of writes from anywhere (including possibly deliberate ones).
>
>> Only the hotspot code should write into the code cache, right? A more secure alternative would be then to use `os::address_is_in_vm()`. That compares against the text segment of the libjvm. Prevents accidental misdiagnosis of writes from anywhere (including possibly deliberate ones).
>
> True, but is `dladdr(3)` safe to call from a sighandler on BSD? I don't know, but I wouldn't have thought so.
To make it safe to call from a signal handler, we could take a snapshot of the boundaries during startup, something like what os::get_loaded_modules_info() does.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26562#discussion_r2283746055
More information about the hotspot-dev
mailing list