Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a714ffff authored by Chris Metcalf's avatar Chris Metcalf
Browse files

arch/tile: fix up some minor trap handling issues



We now respond to MEM_ERROR traps (e.g. an atomic instruction to
non-cacheable memory) with a SIGBUS.

We also no longer generate a console crash message if a user
process die due to a SIGTRAP.

Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent e1723538
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1178,7 +1178,7 @@ STD_ENTRY(fill_ra_stack)
#define do_hardwall_trap bad_intr
#define do_hardwall_trap bad_intr
#endif
#endif


	int_hand     INT_MEM_ERROR, MEM_ERROR, bad_intr
	int_hand     INT_MEM_ERROR, MEM_ERROR, do_trap
	int_hand     INT_SINGLE_STEP_3, SINGLE_STEP_3, bad_intr
	int_hand     INT_SINGLE_STEP_3, SINGLE_STEP_3, bad_intr
#if CONFIG_KERNEL_PL == 2
#if CONFIG_KERNEL_PL == 2
	int_hand     INT_SINGLE_STEP_2, SINGLE_STEP_2, gx_singlestep_handle
	int_hand     INT_SINGLE_STEP_2, SINGLE_STEP_2, gx_singlestep_handle
+7 −2
Original line number Original line Diff line number Diff line
@@ -200,7 +200,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num,
{
{
	siginfo_t info = { 0 };
	siginfo_t info = { 0 };
	int signo, code;
	int signo, code;
	unsigned long address;
	unsigned long address = 0;
	bundle_bits instr;
	bundle_bits instr;


	/* Re-enable interrupts. */
	/* Re-enable interrupts. */
@@ -223,6 +223,10 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num,
	}
	}


	switch (fault_num) {
	switch (fault_num) {
	case INT_MEM_ERROR:
		signo = SIGBUS;
		code = BUS_OBJERR;
		break;
	case INT_ILL:
	case INT_ILL:
		if (copy_from_user(&instr, (void __user *)regs->pc,
		if (copy_from_user(&instr, (void __user *)regs->pc,
				   sizeof(instr))) {
				   sizeof(instr))) {
@@ -312,6 +316,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num,
	info.si_addr = (void __user *)address;
	info.si_addr = (void __user *)address;
	if (signo == SIGILL)
	if (signo == SIGILL)
		info.si_trapno = fault_num;
		info.si_trapno = fault_num;
	if (signo != SIGTRAP)
		trace_unhandled_signal("trap", regs, address, signo);
		trace_unhandled_signal("trap", regs, address, signo);
	force_sig_info(signo, &info, current);
	force_sig_info(signo, &info, current);
}
}