RFR: 8253795: Implementation of JEP 391: macOS/AArch64 Port [v9]
Bernhard Urban-Forster
burban at openjdk.java.net
Wed Feb 3 23:55:07 UTC 2021
On Wed, 3 Feb 2021 22:48:33 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> I don't like the idea of using masks on architectures that do not require them. How about something like this?
>>
>> `#if defined(__APPLE__)`
>> ` // lldb (gdb) installs both standard BSD signal handlers, and mach exception`
>> ` // handlers. By replacing the existing task exception handler, we disable lldb's mach`
>> ` // exception handling, while leaving the standard BSD signal handlers functional.`
>> ` //`
>> ` // EXC_MASK_BAD_ACCESS needed by all architectures for NULL ptr checking`
>> ` // EXC_MASK_ARITHMETIC needed by i386`
>> ` // EXC_MASK_BAD_INSTRUCTION needed by aarch64 to initiate deoptimization`
>> ` kern_return_t kr;`
>> ` kr = task_set_exception_ports(mach_task_self(),`
>> ` EXC_MASK_BAD_ACCESS`
>> ` NOT_LP64(| EXC_MASK_ARITHMETIC)`
>> ` AARCH64_ONLY(| EXC_MASK_BAD_INSTRUCTION),`
>> ` MACH_PORT_NULL,`
>> ` EXCEPTION_STATE_IDENTITY,`
>> ` MACHINE_THREAD_STATE);`
>> ` `
>> ` assert(kr == KERN_SUCCESS, "could not set mach task signal handler");`
>> `#endif`
>>
>> If I just knew why i386 needs `EXC_MASK_ARITHMETIC` and add that to the comment I would be personally happy with that chunk of code.
>
> No idea how to insert spaces and make text align :-(
using ` ```c ` https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks
I was wrong about `SIGFPE` / `EXC_MASK_ARITHMETIC`, it's used on i386, x86_64:
https://github.com/openjdk/jdk/blob/2be60e37e0e433141b2e3d3e32f8e638a4888e3a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp#L467-L524
and aarch64:
https://github.com/AntonKozlov/jdk/blob/80827176cbc5f0dd26003cf234a8076f3f557928/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp#L309-L323
(What happened with the formatting here, ugh?)
Your suggestion sounds good otherwise. @AntonKozlov, do you mind to integrate that?
-------------
PR: https://git.openjdk.java.net/jdk/pull/2200
More information about the security-dev
mailing list