Commit 36bf9680 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Martin Schwidefsky

[S390] fix SIGBUS handling

Raise SIGBUS with a siginfo structure. Deliver BUS_ADRERR as si_code and
the address of the fault in the si_addr field.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 585b954e
...@@ -212,14 +212,21 @@ static noinline void do_sigbus(struct pt_regs *regs, long int_code, ...@@ -212,14 +212,21 @@ static noinline void do_sigbus(struct pt_regs *regs, long int_code,
unsigned long trans_exc_code) unsigned long trans_exc_code)
{ {
struct task_struct *tsk = current; struct task_struct *tsk = current;
unsigned long address;
struct siginfo si;
/* /*
* Send a sigbus, regardless of whether we were in kernel * Send a sigbus, regardless of whether we were in kernel
* or user mode. * or user mode.
*/ */
tsk->thread.prot_addr = trans_exc_code & __FAIL_ADDR_MASK; address = trans_exc_code & __FAIL_ADDR_MASK;
tsk->thread.prot_addr = address;
tsk->thread.trap_no = int_code; tsk->thread.trap_no = int_code;
force_sig(SIGBUS, tsk); si.si_signo = SIGBUS;
si.si_errno = 0;
si.si_code = BUS_ADRERR;
si.si_addr = (void __user *) address;
force_sig_info(SIGBUS, &si, tsk);
} }
#ifdef CONFIG_S390_EXEC_PROTECT #ifdef CONFIG_S390_EXEC_PROTECT
...@@ -279,10 +286,11 @@ static noinline void do_fault_error(struct pt_regs *regs, long int_code, ...@@ -279,10 +286,11 @@ static noinline void do_fault_error(struct pt_regs *regs, long int_code,
if (fault & VM_FAULT_OOM) if (fault & VM_FAULT_OOM)
pagefault_out_of_memory(); pagefault_out_of_memory();
else if (fault & VM_FAULT_SIGBUS) { else if (fault & VM_FAULT_SIGBUS) {
do_sigbus(regs, int_code, trans_exc_code);
/* Kernel mode? Handle exceptions or die */ /* Kernel mode? Handle exceptions or die */
if (!(regs->psw.mask & PSW_MASK_PSTATE)) if (!(regs->psw.mask & PSW_MASK_PSTATE))
do_no_context(regs, int_code, trans_exc_code); do_no_context(regs, int_code, trans_exc_code);
else
do_sigbus(regs, int_code, trans_exc_code);
} else } else
BUG(); BUG();
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment