Skip to contentSkip to conversation

lib: Taint kernel in common report_bug() WARN path.

PATCH In review Paul Mundt 2 participants 2 messages May 16, 2008 Library code

lore
Share & tools
lore

Paul Mundt

author
#0 lore raw

PATCH 1/1 lib: Taint kernel in common report_bug() WARN path.

Commit 95b570c9cef3b12356454c7112571b7e406b4b51 introduced a TAINT_WARN that was implemented for all architectures using the generic warn_on_slowpath(), which excluded any architecture that set HAVE_ARCH_WARN_ON.

As all of the architectures that implement their own WARN_ON() all go through the report_bug() path (specifically handling BUG_TRAP_TYPE_WARN), taint the kernel there as well for consistency.

Tested on avr32 and sh. Also relevant for s390, parisc, and powerpc.

---

lib/bug.c +2 -0
index 530f38f..bfeafd6 100644
@@ -37,6 +37,7 @@
  */
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/kernel.h>
 #include <linux/bug.h>
 #include <linux/sched.h>
 
@@ -149,6 +150,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
 			       (void *)bugaddr);
 
 		show_regs(regs);
+		add_taint(TAINT_WARN);
 		return BUG_TRAP_TYPE_WARN;
 	}
 
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Paul Mundt

Commit 95b570c9cef3b12356454c7112571b7e406b4b51 introduced a TAINT_WARN that was implemented for all architectures using the generic warn_on_slowpath(), which excluded any architecture that set HAVE_ARCH_WARN_ON.

Quoted 9 lines

As all of the architectures that implement their own WARN_ON() all go through the report_bug() path (specifically handling BUG_TRAP_TYPE_WARN), taint the kernel there as well for consistency.

Tested on avr32 and sh. Also relevant for s390, parisc, and powerpc.

obviously fine by me.