[PATCH 3/4] MIPS: Allow bus error handlers to request quiet behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new MIPS_BE_FATAL_QUIET value which bus error handlers can return
to indicate that a bus error triggered by user code should be treated
the same way as MIPS_BE_FATAL, ie. we should deliver a SIGBUS, but the
kernel shouldn't print information about the bus error to the kernel
log.

This will be useful in a further commit which will silence kernel log
output from bus errors caused by user code performing smaller than 32
bit accesses to the GIC user page, which generates a bus error. Notably
this will silence a ton of output from crashme, which seems to be rather
eager to access the GIC user page in weird & wonderful ways.

Signed-off-by: Paul Burton <paul.burton@xxxxxxxxxx>
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: linux-mips@xxxxxxxxxxxxxx
---

 arch/mips/include/asm/traps.h | 1 +
 arch/mips/kernel/traps.c      | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/traps.h b/arch/mips/include/asm/traps.h
index f41cf3ee82a7..7594fb496001 100644
--- a/arch/mips/include/asm/traps.h
+++ b/arch/mips/include/asm/traps.h
@@ -17,6 +17,7 @@
 #define MIPS_BE_DISCARD 0		/* return with no action */
 #define MIPS_BE_FIXUP	1		/* return to the fixup code */
 #define MIPS_BE_FATAL	2		/* treat as an unrecoverable error */
+#define MIPS_BE_FATAL_QUIET	3	/* treat as an unrecoverable error */
 
 extern void (*board_be_init)(void);
 extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 259e2d259204..2f4546e4abdb 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -465,6 +465,9 @@ asmlinkage void do_be(struct pt_regs *regs)
 			goto out;
 		}
 		break;
+	case MIPS_BE_FATAL_QUIET:
+		if (user_mode(regs))
+			goto out_sigbus;
 	default:
 		break;
 	}
@@ -480,8 +483,8 @@ asmlinkage void do_be(struct pt_regs *regs)
 		goto out;
 
 	die_if_kernel("Oops", regs);
+out_sigbus:
 	force_sig(SIGBUS, current);
-
 out:
 	exception_exit(prev_state);
 }
-- 
2.14.1



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux