comparison src/os/bsd/vm/os_bsd.cpp @ 10386:6bf8b8bb7c19

8009302: Mac OS X: JVM crash on infinite recursion on Appkit Thread Summary: Use SA_ONSTACK flag to ensure signal gets delivered properly. Reviewed-by: dholmes, coleenp Contributed-by: gerard.ziemski@oracle.com
author hseigel
date Wed, 05 Jun 2013 14:12:49 -0400
parents 9ce110b1d14a
children f8c8cace25ad
comparison
equal deleted inserted replaced
10385:62e7bac9524f 10386:6bf8b8bb7c19
3028 sigAct.sa_flags = SA_SIGINFO|SA_RESTART; 3028 sigAct.sa_flags = SA_SIGINFO|SA_RESTART;
3029 } else { 3029 } else {
3030 sigAct.sa_sigaction = signalHandler; 3030 sigAct.sa_sigaction = signalHandler;
3031 sigAct.sa_flags = SA_SIGINFO|SA_RESTART; 3031 sigAct.sa_flags = SA_SIGINFO|SA_RESTART;
3032 } 3032 }
3033 #if __APPLE__
3034 // Needed for main thread as XNU (Mac OS X kernel) will only deliver SIGSEGV
3035 // (which starts as SIGBUS) on main thread with faulting address inside "stack+guard pages"
3036 // if the signal handler declares it will handle it on alternate stack.
3037 // Notice we only declare we will handle it on alt stack, but we are not
3038 // actually going to use real alt stack - this is just a workaround.
3039 // Please see ux_exception.c, method catch_mach_exception_raise for details
3040 // link http://www.opensource.apple.com/source/xnu/xnu-2050.18.24/bsd/uxkern/ux_exception.c
3041 if (sig == SIGSEGV) {
3042 sigAct.sa_flags |= SA_ONSTACK;
3043 }
3044 #endif
3045
3033 // Save flags, which are set by ours 3046 // Save flags, which are set by ours
3034 assert(sig > 0 && sig < MAXSIGNUM, "vm signal out of expected range"); 3047 assert(sig > 0 && sig < MAXSIGNUM, "vm signal out of expected range");
3035 sigflags[sig] = sigAct.sa_flags; 3048 sigflags[sig] = sigAct.sa_flags;
3036 3049
3037 int ret = sigaction(sig, &sigAct, &oldAct); 3050 int ret = sigaction(sig, &sigAct, &oldAct);