Re: RFR: 8253795: Implementation of JEP 391: macOS/AArch64 Port [v23]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8253795: Implementation of JEP 391: macOS/AArch64 Port [v23]

Anton Kozlov-2
On Wed, 3 Mar 2021 15:57:13 GMT, Gerard Ziemski <[hidden email]> wrote:

>> src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp line 207:
>>
>>> 205:   // Enable WXWrite: this function is called by the signal handler at arbitrary
>>> 206:   // point of execution.
>>> 207:   ThreadWXEnable wx(WXWrite, thread);
>>
>> Note that `thread` can be NULL here if the signal handler is running in a non-attached thread. If we then perform:
>> `ThreadWXEnable(WXMode new_mode, Thread* thread = NULL) :
>>     _thread(thread ? thread : Thread::current()),`
>> we call Thread::current() on a non-attached thread and that will assert/crash if we get NULL. Either avoid using WX when the thread is NULL, or else change to use Thread::current_or_null_safe() and ensure all uses have a NULL check.
>
>> Note that `thread` can be NULL here if the signal handler is running in a non-attached thread. If we then perform:
>> `ThreadWXEnable(WXMode new_mode, Thread* thread = NULL) : _thread(thread ? thread : Thread::current()),`
>> we call Thread::current() on a non-attached thread and that will assert/crash if we get NULL. Either avoid using WX when the thread is NULL, or else change to use Thread::current_or_null_safe() and ensure all uses have a NULL check.
>
> https://bugs.openjdk.java.net/browse/JDK-8262903 tracks this issue.

Thanks for report and analysis! I fixed this in https://github.com/openjdk/jdk/pull/2200/commits/f6fb01b24f525e578692a1c6f2ff0a55b8233576

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

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