[PATCH 2/2] UBUNTU: expose that this is an Ubuntu kernel in oops/panic messages

Andy Whitcroft apw at canonical.com
Thu Nov 27 19:09:50 UTC 2008

In order to make it simpler for kerneloops to know it is dealing with
an Ubuntu modified kernel we have been requested to modify our version
strings to contain an Ubuntu marker.  Changing our version string will
move our modules about and trigger all sorts of pain for our packaging.

This patch proposes an alternative method of marking these oopses as
Ubuntu related.  All oopses which contain the kernel release string also
contain the tainted flags:
first word of the UTS_VERSION string, which is typically
the build number:

    WARNING: at /tmp/oops.c:5 modinit() (Not tainted)
    Pid: 8190, comm: insmod Not tainted 2.6.24-0.77.rc4.git4.fc9 #1
     [<c040649a>] show_trace_log_lvl+0x1a/0x2f

The tainted bits are generated in one place in kernel/panic.c so it
is possible to augment those to include an Ubuntu marker, with a high
probability of it being emitted with the version number.  Something like
this (hand crafted):

WARNING: at /tmp/oops.c:5 modinit() (Not tainted)
Pid: 8190, comm: insmod Not tainted Ubuntu 2.6.24-0.77.rc4.git4.fc9 #1
 [<c040649a>] show_trace_log_lvl+0x1a/0x2f

This is only exposed in these human readable strings hopefully this would
not affect any other part of our tooling.

Signed-off-by: Andy Whitcroft <apw at canonical.com>
 kernel/panic.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 12c5a0a..6aed9b5 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -161,9 +161,10 @@ EXPORT_SYMBOL(panic);
 const char *print_tainted(void)
-	static char buf[20];
+	static char buf[28];
 	if (tainted) {
-		snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c",
+		snprintf(buf, sizeof(buf),
+			"Tainted: %c%c%c%c%c%c%c%c%c%c Ubuntu",
 			tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
 			tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
 			tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
@@ -176,7 +177,7 @@ const char *print_tainted(void)
 			tainted & TAINT_WARN ? 'W' : ' ');
-		snprintf(buf, sizeof(buf), "Not tainted");
+		snprintf(buf, sizeof(buf), "Not tainted Ubuntu");

More information about the kernel-team mailing list