mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8009302: Mac OS X: JVM crash on infinite recursion on Appkit Thread
Use SA_ONSTACK flag to ensure signal gets delivered properly. Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
f3fb3c4777
commit
2fad2249a2
1 changed files with 13 additions and 0 deletions
|
@ -3030,6 +3030,19 @@ void os::Bsd::set_signal_handler(int sig, bool set_installed) {
|
|||
sigAct.sa_sigaction = signalHandler;
|
||||
sigAct.sa_flags = SA_SIGINFO|SA_RESTART;
|
||||
}
|
||||
#if __APPLE__
|
||||
// Needed for main thread as XNU (Mac OS X kernel) will only deliver SIGSEGV
|
||||
// (which starts as SIGBUS) on main thread with faulting address inside "stack+guard pages"
|
||||
// if the signal handler declares it will handle it on alternate stack.
|
||||
// Notice we only declare we will handle it on alt stack, but we are not
|
||||
// actually going to use real alt stack - this is just a workaround.
|
||||
// Please see ux_exception.c, method catch_mach_exception_raise for details
|
||||
// link http://www.opensource.apple.com/source/xnu/xnu-2050.18.24/bsd/uxkern/ux_exception.c
|
||||
if (sig == SIGSEGV) {
|
||||
sigAct.sa_flags |= SA_ONSTACK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Save flags, which are set by ours
|
||||
assert(sig > 0 && sig < MAXSIGNUM, "vm signal out of expected range");
|
||||
sigflags[sig] = sigAct.sa_flags;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue