Skip to content

Commit b9fa036

Browse files
hikerockiesdavem330
authored andcommitted
sparc64: Update signal delivery to use new helper functions
Commit f8ec660 ("signal: Add send_sig_fault and force_sig_fault") added new helper functions to streamline signal delivery. This patch updates signal delivery for new/updated handlers for ADI related exceptions to use the helper function. Signed-off-by: Khalid Aziz <[email protected]> Cc: Khalid Aziz <[email protected]> Acked-by: "Eric W. Biederman" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 74a0496 commit b9fa036

File tree

1 file changed

+9
-29
lines changed

1 file changed

+9
-29
lines changed

arch/sparc/kernel/traps_64.c

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
362362
{
363363
unsigned short type = (type_ctx >> 16);
364364
unsigned short ctx = (type_ctx & 0xffff);
365-
siginfo_t info;
366365

367366
if (notify_die(DIE_TRAP, "data access exception", regs,
368367
0, 0x8, SIGTRAP) == NOTIFY_STOP)
@@ -406,24 +405,18 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
406405
* kerbel by HV as data access exception with fault type set to
407406
* HV_FAULT_TYPE_INV_ASI.
408407
*/
409-
info.si_errno = 0;
410-
info.si_addr = (void __user *) addr;
411-
info.si_trapno = 0;
412408
switch (type) {
413409
case HV_FAULT_TYPE_INV_ASI:
414-
info.si_signo = SIGILL;
415-
info.si_code = ILL_ILLADR;
416-
force_sig_info(SIGILL, &info, current);
410+
force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0,
411+
current);
417412
break;
418413
case HV_FAULT_TYPE_MCD_DIS:
419-
info.si_signo = SIGSEGV;
420-
info.si_code = SEGV_ACCADI;
421-
force_sig_info(SIGSEGV, &info, current);
414+
force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0,
415+
current);
422416
break;
423417
default:
424-
info.si_signo = SIGSEGV;
425-
info.si_code = SEGV_MAPERR;
426-
force_sig_info(SIGSEGV, &info, current);
418+
force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0,
419+
current);
427420
break;
428421
}
429422
}
@@ -2073,8 +2066,6 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
20732066
*/
20742067
void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
20752068
{
2076-
siginfo_t info;
2077-
20782069
if (notify_die(DIE_TRAP, "MCD error", regs, 0, 0x34,
20792070
SIGSEGV) == NOTIFY_STOP)
20802071
return;
@@ -2110,12 +2101,8 @@ void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
21102101
/* Send SIGSEGV to the userspace process with the right signal
21112102
* code
21122103
*/
2113-
info.si_signo = SIGSEGV;
2114-
info.si_errno = 0;
2115-
info.si_code = SEGV_ADIDERR;
2116-
info.si_addr = (void __user *)ent.err_raddr;
2117-
info.si_trapno = 0;
2118-
force_sig_info(SIGSEGV, &info, current);
2104+
force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr,
2105+
0, current);
21192106
}
21202107

21212108
/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
@@ -2748,8 +2735,6 @@ void sun4v_do_mna(struct pt_regs *regs, unsigned long addr, unsigned long type_c
27482735
void sun4v_mem_corrupt_detect_precise(struct pt_regs *regs, unsigned long addr,
27492736
unsigned long context)
27502737
{
2751-
siginfo_t info;
2752-
27532738
if (notify_die(DIE_TRAP, "memory corruption precise exception", regs,
27542739
0, 0x8, SIGSEGV) == NOTIFY_STOP)
27552740
return;
@@ -2784,12 +2769,7 @@ void sun4v_mem_corrupt_detect_precise(struct pt_regs *regs, unsigned long addr,
27842769
regs->tpc &= 0xffffffff;
27852770
regs->tnpc &= 0xffffffff;
27862771
}
2787-
info.si_signo = SIGSEGV;
2788-
info.si_code = SEGV_ADIPERR;
2789-
info.si_errno = 0;
2790-
info.si_addr = (void __user *) addr;
2791-
info.si_trapno = 0;
2792-
force_sig_info(SIGSEGV, &info, current);
2772+
force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0, current);
27932773
}
27942774

27952775
void do_privop(struct pt_regs *regs)

0 commit comments

Comments
 (0)