# HG changeset patch # User stuefe # Date 1490102046 -3600 # Node ID 2682034b1024adb59be74caf3e58f2d8a26222bf # Parent 772fdcc00f272e8cb5309883ece697d1339f56e9 8176872: [s390] wrong pc shown in error logs Reviewed-by: dholmes, dsamersoff diff --git a/src/os/posix/vm/vmError_posix.cpp b/src/os/posix/vm/vmError_posix.cpp --- a/src/os/posix/vm/vmError_posix.cpp +++ b/src/os/posix/vm/vmError_posix.cpp @@ -115,7 +115,12 @@ // support safefetch faults in error handling ucontext_t* const uc = (ucontext_t*) ucVoid; - address const pc = uc ? os::Posix::ucontext_get_pc(uc) : NULL; + address pc = (uc == NULL) ? os::Posix::ucontext_get_pc(uc) : NULL; + + // Correct pc for SIGILL, SIGFPE (see JDK-8176872) + if (sig == SIGILL || sig == SIGFPE) { + pc = (address) info->si_addr; + } if (uc && pc && StubRoutines::is_safefetch_fault(pc)) { os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); diff --git a/src/os_cpu/linux_s390/vm/os_linux_s390.cpp b/src/os_cpu/linux_s390/vm/os_linux_s390.cpp --- a/src/os_cpu/linux_s390/vm/os_linux_s390.cpp +++ b/src/os_cpu/linux_s390/vm/os_linux_s390.cpp @@ -505,6 +505,14 @@ sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); + // Hand down correct pc for SIGILL, SIGFPE. pc from context + // usually points to the instruction after the failing instruction. + // Note: this should be combined with the trap_pc handling above, + // because it handles the same issue. + if (sig == SIGILL || sig == SIGFPE) { + pc = (address) info->si_addr; + } + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere();