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

Anton Kozlov akozlov at openjdk.java.net
Fri Feb 5 16:17:50 UTC 2021


On Wed, 3 Feb 2021 23:29:30 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> 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?
>
> So it should be:
> 
> #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 all architectures for div by 0 checking
>   // 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 | 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

Thanks! I've updated the PR with this code, with extra indentation of `AARCH64_ONLY(...)` line, since this is continuation of the first parameter.

I'll fix the formatting in os_bsd_arch64.cpp along other changes to `bsd_aarch64` directory

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

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



More information about the security-dev mailing list