Skip to contentSkip to conversation

Let us die more gracefully

PATCH In review Jun Sun 2 participants 3 messages Jul 19, 2002 – Jul 22, 2002 MIPS

lore
Share & tools
lore

Jun Sun

author
#0 lore raw

PATCH 1/1 Let us die more gracefully

This patch dumps the offending code context rather than dumping the context of do_ri() function call itself.

Apply to both branches. (Same is true with the previous patch)

Jun

arch/mips/kernel/traps.c renamed from arch/mips/kernel/traps.c.orig +1 -2
diff -Nru linux/arch/mips/kernel/traps.c.orig linux/arch/mips/kernel/traps.c
@@ -614,8 +614,7 @@
  */
 asmlinkage void do_ri(struct pt_regs *regs)
 {
-	if (!user_mode(regs))
-		BUG();
+	die_if_kernel("no ll/sc emulation for kernel code", regs);
 
 #ifndef CONFIG_CPU_HAS_LLSC
 
#1 lore raw
Quoted 2 lines · Jun Sun

This patch dumps the offending code context rather than dumping the context of do_ri() function call itself.

The message is misleading -- the reason may be any illegal opcode.

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +
author
#2 lore raw
Quoted 8 lines · Maciej W. Rozycki
Quoted 1 line · Jun Sun

This patch dumps the offending code context rather than dumping the context of do_ri() function call itself.

The message is misleading -- the reason may be any illegal opcode.

That is true. Here is the revised one.

Jun

arch/mips/kernel/traps.c renamed from arch/mips/kernel/traps.c.orig +1 -2
diff -Nru linux/arch/mips/kernel/traps.c.orig linux/arch/mips/kernel/traps.c
@@ -614,8 +614,7 @@
  */
 asmlinkage void do_ri(struct pt_regs *regs)
 {
-	if (!user_mode(regs))
-		BUG();
+	die_if_kernel("Reserved instruction in kernel code", regs);
 
 #ifndef CONFIG_CPU_HAS_LLSC