JDK-8251201 : macOS: remove 10.4 workaround from os::Bsd::install_signal_handlers
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: os_x
  • Submitted: 2020-08-05
  • Updated: 2024-07-10
  • Resolved: 2024-07-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Blocks :  
Description
void os::Bsd::install_signal_handlers() {
...
#if defined(__APPLE__)
    // In Mac OS X 10.4, CrashReporter will write a crash log for all 'fatal' signals, including
    // signals caught and handled by the JVM. To work around this, we reset the mach task
    // signal handler that's placed on our process by CrashReporter. This disables
    // CrashReporter-based reporting.
    //
    // This work-around is not necessary for 10.5+, as CrashReporter no longer intercedes
    // on caught fatal signals.
    //
    // Additionally, gdb installs both standard BSD signal handlers, and mach exception
    // handlers. By replacing the existing task exception handler, we disable gdb's mach
    // exception handling, while leaving the standard BSD signal handlers functional.
    kern_return_t kr;
    kr = task_set_exception_ports(mach_task_self(),
                                  EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC,
                                  MACH_PORT_NULL,
                                  EXCEPTION_STATE_IDENTITY,
                                  MACHINE_THREAD_STATE);

    assert(kr == KERN_SUCCESS, "could not set mach task signal handler");
#endif
...
}
Comments
[RT Triage]: Workaround should remain in place since it still is needed. See Gerard's comment.
10-07-2024

The top of the comment does not apply, but the "gdb" applies still (to lldb). Might need to change the comment though, and there is a question regarding what the mask needs to be exactly. Lastly, https://bugs.openjdk.java.net/browse/JDK-8253795 will extend the mask by adding "EXC_MASK_BAD_INSTRUCTION", which is needed on macOS aarch64 for deoptimization.
03-02-2021