mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8220794: PPC64: Fix signal handler for SIGSEGV on branch to illegal address
Reviewed-by: stuefe, goetz
This commit is contained in:
parent
06fa31e9bc
commit
db264da0fd
1 changed files with 19 additions and 2 deletions
|
@ -132,6 +132,10 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long ucontext_get_trap(const ucontext_t * uc) {
|
||||||
|
return uc->uc_mcontext.regs->trap;
|
||||||
|
}
|
||||||
|
|
||||||
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
|
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
|
||||||
intptr_t** ret_sp, intptr_t** ret_fp) {
|
intptr_t** ret_sp, intptr_t** ret_fp) {
|
||||||
|
|
||||||
|
@ -304,9 +308,22 @@ JVM_handle_linux_signal(int sig,
|
||||||
|
|
||||||
// Handle ALL stack overflow variations here
|
// Handle ALL stack overflow variations here
|
||||||
if (sig == SIGSEGV) {
|
if (sig == SIGSEGV) {
|
||||||
// Si_addr may not be valid due to a bug in the linux-ppc64 kernel (see
|
// si_addr may not be valid due to a bug in the linux-ppc64 kernel (see
|
||||||
// comment below). Use get_stack_bang_address instead of si_addr.
|
// comment below). Use get_stack_bang_address instead of si_addr.
|
||||||
address addr = ((NativeInstruction*)pc)->get_stack_bang_address(uc);
|
// If SIGSEGV is caused due to a branch to an invalid address an
|
||||||
|
// "Instruction Storage" interruption is generated and 'pc' (NIP) already
|
||||||
|
// contains the invalid address. Otherwise, the SIGSEGV is caused due to
|
||||||
|
// load/store instruction trying to load/store from/to an invalid address
|
||||||
|
// and causing a "Data Storage" interruption, so we inspect the intruction
|
||||||
|
// in order to extract the faulty data addresss.
|
||||||
|
address addr;
|
||||||
|
if ((ucontext_get_trap(uc) & 0x0F00 /* no IRQ reply bits */) == 0x0400) {
|
||||||
|
// Instruction interruption
|
||||||
|
addr = pc;
|
||||||
|
} else {
|
||||||
|
// Data interruption (0x0300): extract faulty data address
|
||||||
|
addr = ((NativeInstruction*)pc)->get_stack_bang_address(uc);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if fault address is within thread stack.
|
// Check if fault address is within thread stack.
|
||||||
if (thread->on_local_stack(addr)) {
|
if (thread->on_local_stack(addr)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue