Commit 2c9f7eaf authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP

While reviewing the signal handlers on sparc it became clear that
si_trapno is only set to a non-zero value when sending SIGILL with
si_code ILL_ILLTRP.

Add force_sig_fault_trapno and send SIGILL ILL_ILLTRP with it.

Remove the define of __ARCH_SI_TRAPNO and remove the always zero
si_trapno parameter from send_sig_fault and force_sig_fault.

v1: https://lkml.kernel.org/r/m1eeers7q7.fsf_-_@fess.ebiederm.org
v2: https://lkml.kernel.org/r/20210505141101.11519-7-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/87mtqnxx89.fsf_-_@disp2133


Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 726e337b
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -8,9 +8,6 @@

#endif /* defined(__sparc__) && defined(__arch64__) */


#define __ARCH_SI_TRAPNO

#include <asm-generic/siginfo.h>


+1 −1
Original line number Diff line number Diff line
@@ -518,7 +518,7 @@ void synchronize_user_stack(void)

static void stack_unaligned(unsigned long sp)
{
	force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0);
	force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp);
}

static const char uwfault32[] = KERN_INFO \
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ sparc_breakpoint (struct pt_regs *regs)
#ifdef DEBUG_SPARC_BREAKPOINT
        printk ("TRAP: Entering kernel PC=%x, nPC=%x\n", regs->pc, regs->npc);
#endif
	force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->pc, 0);
	force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->pc);

#ifdef DEBUG_SPARC_BREAKPOINT
	printk ("TRAP: Returning to space: PC=%x nPC=%x\n", regs->pc, regs->npc);
+1 −1
Original line number Diff line number Diff line
@@ -514,7 +514,7 @@ asmlinkage void sparc_breakpoint(struct pt_regs *regs)
#ifdef DEBUG_SPARC_BREAKPOINT
        printk ("TRAP: Entering kernel PC=%lx, nPC=%lx\n", regs->tpc, regs->tnpc);
#endif
	force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->tpc, 0);
	force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->tpc);
#ifdef DEBUG_SPARC_BREAKPOINT
	printk ("TRAP: Returning to space: PC=%lx nPC=%lx\n", regs->tpc, regs->tnpc);
#endif
+11 −11
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ void do_hw_interrupt(struct pt_regs *regs, unsigned long type)
	if(regs->psr & PSR_PS)
		die_if_kernel("Kernel bad trap", regs);

	force_sig_fault(SIGILL, ILL_ILLTRP,
	force_sig_fault_trapno(SIGILL, ILL_ILLTRP,
			       (void __user *)regs->pc, type - 0x80);
}

@@ -116,7 +116,7 @@ void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned lon
	       regs->pc, *(unsigned long *)regs->pc);
#endif

	send_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0, current);
	send_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, current);
}

void do_priv_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
@@ -124,7 +124,7 @@ void do_priv_instruction(struct pt_regs *regs, unsigned long pc, unsigned long n
{
	if(psr & PSR_PS)
		die_if_kernel("Penguin instruction from Penguin mode??!?!", regs);
	send_sig_fault(SIGILL, ILL_PRVOPC, (void __user *)pc, 0, current);
	send_sig_fault(SIGILL, ILL_PRVOPC, (void __user *)pc, current);
}

/* XXX User may want to be allowed to do this. XXX */
@@ -145,7 +145,7 @@ void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, unsigned lon
#endif
	send_sig_fault(SIGBUS, BUS_ADRALN,
		       /* FIXME: Should dig out mna address */ (void *)0,
		       0, current);
		       current);
}

static unsigned long init_fsr = 0x0UL;
@@ -291,7 +291,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
		else if (fsr & 0x01)
			code = FPE_FLTRES;
	}
	send_sig_fault(SIGFPE, code, (void __user *)pc, 0, fpt);
	send_sig_fault(SIGFPE, code, (void __user *)pc, fpt);
#ifndef CONFIG_SMP
	last_task_used_math = NULL;
#endif
@@ -305,7 +305,7 @@ void handle_tag_overflow(struct pt_regs *regs, unsigned long pc, unsigned long n
{
	if(psr & PSR_PS)
		die_if_kernel("Penguin overflow trap from kernel mode", regs);
	send_sig_fault(SIGEMT, EMT_TAGOVF, (void __user *)pc, 0, current);
	send_sig_fault(SIGEMT, EMT_TAGOVF, (void __user *)pc, current);
}

void handle_watchpoint(struct pt_regs *regs, unsigned long pc, unsigned long npc,
@@ -327,13 +327,13 @@ void handle_reg_access(struct pt_regs *regs, unsigned long pc, unsigned long npc
	printk("Register Access Exception at PC %08lx NPC %08lx PSR %08lx\n",
	       pc, npc, psr);
#endif
	force_sig_fault(SIGBUS, BUS_OBJERR, (void __user *)pc, 0);
	force_sig_fault(SIGBUS, BUS_OBJERR, (void __user *)pc);
}

void handle_cp_disabled(struct pt_regs *regs, unsigned long pc, unsigned long npc,
			unsigned long psr)
{
	send_sig_fault(SIGILL, ILL_COPROC, (void __user *)pc, 0, current);
	send_sig_fault(SIGILL, ILL_COPROC, (void __user *)pc, current);
}

void handle_cp_exception(struct pt_regs *regs, unsigned long pc, unsigned long npc,
@@ -343,13 +343,13 @@ void handle_cp_exception(struct pt_regs *regs, unsigned long pc, unsigned long n
	printk("Co-Processor Exception at PC %08lx NPC %08lx PSR %08lx\n",
	       pc, npc, psr);
#endif
	send_sig_fault(SIGILL, ILL_COPROC, (void __user *)pc, 0, current);
	send_sig_fault(SIGILL, ILL_COPROC, (void __user *)pc, current);
}

void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, unsigned long npc,
		       unsigned long psr)
{
	send_sig_fault(SIGFPE, FPE_INTDIV, (void __user *)pc, 0, current);
	send_sig_fault(SIGFPE, FPE_INTDIV, (void __user *)pc, current);
}

#ifdef CONFIG_DEBUG_BUGVERBOSE
Loading