RFR (XS): 7129715: MAC: SIGBUS in nsk stress test

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Jun 14 10:16:42 PDT 2012

Thank you, Roland, for fixing this

Please, add a comment to your change since it is different from other platforms. 
We may want to add the same check on other platforms to skip unneeded additional 
checks. But I will let Runtime group to handle that.


Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/7129715/webrev.00/
> StackOverflowError exceptions may get lost on OSX. The changes that were made to the signal handler to check for SIGSEGV or SIGBUS rather than only SIGSEGV or only SIGBUS in several places broke the logic of the handler.
> With the test of the CR, the thread catches a SIGSEGV or SIGBUS because it's exhausting its stack. The stub to return to is set:
> stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
> but it is overwritten in:
> #if defined(__APPLE__)
>       // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. 
>       // 64-bit Darwin may also use a SIGBUS (seen with compressed oops).
>       // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from
>       // being called, so only do so if the implicit NULL check is not necessary.
>       } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
> #else
>       } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
> #endif
>         // BugId 4454115: A read from a MappedByteBuffer can fault                                                                                   
>         // here if the underlying file has been truncated.
>         // Do not crash the VM in such a case.                                                                                    
>         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
>         nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
>         if (nm != NULL && nm->has_unsafe_access()) {
>           stub = StubRoutines::handler_for_unsafe_access();
>         }
> so the stack overflow exception is not thrown and the thread continues growing the stack leading to a fatal error.
> Roland.

More information about the hotspot-runtime-dev mailing list