linux-image: Include package version along with kernel release in stack traces

Currently only some architectures (arm,ia64,powerpc,s390,sh,x86)
include the kernel release.  Don't add the package version on other
architectures at this time, as it's less obvious where it should go.

svn path=/dists/sid/linux/; revision=19290
This commit is contained in:
Ben Hutchings 2012-07-24 02:57:54 +00:00
parent aca61360d7
commit 40f0b32367
2 changed files with 210 additions and 3 deletions

2
debian/changelog vendored
View File

@ -3,6 +3,8 @@ linux (3.2.23-2) UNRELEASED; urgency=low
* linux-image: Include package version in utsname version string
('uname -v' output) (Closes: #638878)
* linux-source: Drop support for version.$DISTRIBUTION
* [arm,ia64,powerpc,s390,sh,x86] linux-image: Include package version
in stack traces from WARN, BUG, Oops etc.
-- Ben Hutchings <ben@decadent.org.uk> Tue, 24 Jul 2012 02:20:37 +0100

View File

@ -1,6 +1,6 @@
From: Ben Hutchings <ben@decadent.org.uk>
Subject: Add header file with package version information
Date: Tue, 24 Jul 2012 02:15:43 +0100
Subject: Include package version along with kernel release in stack traces
Date: Tue, 24 Jul 2012 03:13:10 +0100
For distribution binary packages we assume
$DISTRIBUTION_OFFICIAL_BUILD, $DISTRIBUTOR and $DISTRIBUTION_VERSION
@ -23,7 +23,7 @@ are set.
+ifneq ($(DISTRIBUTION_OFFICIAL_BUILD),)
+define filechk_package.h
+ echo \#define LINUX_PACKAGE_ID \"$(DISTRIBUTOR) $(DISTRIBUTION_VERSION)\"
+ echo \#define LINUX_PACKAGE_ID \" $(DISTRIBUTOR) $(DISTRIBUTION_VERSION)\"
+endef
+else
+define filechk_package.h
@ -43,3 +43,208 @@ are set.
PHONY += headerdep
headerdep:
$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -33,6 +33,7 @@
#include <linux/kprobes.h>
#include <linux/bug.h>
#include <linux/utsname.h>
+#include <generated/package.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -166,11 +167,12 @@ static void show_last_breaking_event(str
*/
void dump_stack(void)
{
- printk("CPU: %d %s %s %.*s\n",
+ printk("CPU: %d %s %s %.*s%s\n",
task_thread_info(current)->cpu, print_tainted(),
init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ LINUX_PACKAGE_ID);
printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
current->comm, current->pid, current,
(void *) current->thread.ksp);
@@ -217,11 +219,12 @@ void show_registers(struct pt_regs *regs
void show_regs(struct pt_regs *regs)
{
print_modules();
- printk("CPU: %d %s %s %.*s\n",
+ printk("CPU: %d %s %s %.*s%s\n",
task_thread_info(current)->cpu, print_tainted(),
init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ LINUX_PACKAGE_ID);
printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
current->comm, current->pid, current,
(void *) current->thread.ksp);
--- a/arch/x86/um/sysrq_64.c
+++ b/arch/x86/um/sysrq_64.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/utsname.h>
+#include <generated/package.h>
#include <asm/current.h>
#include <asm/ptrace.h>
#include "sysrq.h"
@@ -16,8 +17,9 @@ void __show_regs(struct pt_regs *regs)
{
printk("\n");
print_modules();
- printk(KERN_INFO "Pid: %d, comm: %.20s %s %s\n", task_pid_nr(current),
- current->comm, print_tainted(), init_utsname()->release);
+ printk(KERN_INFO "Pid: %d, comm: %.20s %s %s%s\n", task_pid_nr(current),
+ current->comm, print_tainted(), init_utsname()->release,
+ LINUX_PACKAGE_ID);
printk(KERN_INFO "RIP: %04lx:[<%016lx>]\n", PT_REGS_CS(regs) & 0xffff,
PT_REGS_RIP(regs));
printk(KERN_INFO "RSP: %016lx EFLAGS: %08lx\n", PT_REGS_SP(regs),
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -14,6 +14,7 @@
#include <linux/utsname.h>
#include <trace/events/power.h>
#include <linux/hw_breakpoint.h>
+#include <generated/package.h>
#include <asm/cpu.h>
#include <asm/system.h>
#include <asm/apic.h>
@@ -105,11 +106,12 @@ void show_regs_common(void)
board = dmi_get_system_info(DMI_BOARD_NAME);
printk(KERN_CONT "\n");
- printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s",
+ printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s%s",
current->pid, current->comm, print_tainted(),
init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ LINUX_PACKAGE_ID);
printk(KERN_CONT " %s %s", vendor, product);
if (board)
printk(KERN_CONT "/%s", board);
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -15,6 +15,7 @@
#include <linux/bug.h>
#include <linux/nmi.h>
#include <linux/sysfs.h>
+#include <generated/package.h>
#include <asm/stacktrace.h>
@@ -185,11 +186,12 @@ void dump_stack(void)
unsigned long stack;
bp = stack_frame(current, NULL);
- printk("Pid: %d, comm: %.20s %s %s %.*s\n",
+ printk("Pid: %d, comm: %.20s %s %s %.*s%s\n",
current->pid, current->comm, print_tainted(),
init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ LINUX_PACKAGE_ID);
show_trace(NULL, NULL, &stack, bp);
}
EXPORT_SYMBOL(dump_stack);
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -29,6 +29,7 @@
#include <linux/kdebug.h>
#include <linux/utsname.h>
#include <linux/tracehook.h>
+#include <generated/package.h>
#include <asm/cpu.h>
#include <asm/delay.h>
@@ -111,9 +112,9 @@ show_regs (struct pt_regs *regs)
print_modules();
printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
smp_processor_id(), current->comm);
- printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
+ printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s%s)\n",
regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
- init_utsname()->release);
+ init_utsname()->release, LINUX_PACKAGE_ID);
print_symbol("ip is at %s\n", ip);
printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -31,6 +31,7 @@
#include <linux/random.h>
#include <linux/hw_breakpoint.h>
#include <linux/cpuidle.h>
+#include <generated/package.h>
#include <asm/cacheflush.h>
#include <asm/leds.h>
@@ -261,11 +262,12 @@ void __show_regs(struct pt_regs *regs)
unsigned long flags;
char buf[64];
- printk("CPU: %d %s (%s %.*s)\n",
+ printk("CPU: %d %s (%s %.*s%s)\n",
raw_smp_processor_id(), print_tainted(),
init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ LINUX_PACKAGE_ID);
print_symbol("PC is at %s\n", instruction_pointer(regs));
print_symbol("LR is at %s\n", regs->ARM_lr);
printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -38,6 +38,7 @@
#include <linux/personality.h>
#include <linux/random.h>
#include <linux/hw_breakpoint.h>
+#include <generated/package.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
@@ -626,8 +627,9 @@ void show_regs(struct pt_regs * regs)
printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
regs->nip, regs->link, regs->ctr);
- printk("REGS: %p TRAP: %04lx %s (%s)\n",
- regs, regs->trap, print_tainted(), init_utsname()->release);
+ printk("REGS: %p TRAP: %04lx %s (%s%s)\n",
+ regs, regs->trap, print_tainted(), init_utsname()->release,
+ LINUX_PACKAGE_ID);
printk("MSR: "REG" ", regs->msr);
printbits(regs->msr, msr_bits);
printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer);
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -22,6 +22,7 @@
#include <linux/ftrace.h>
#include <linux/hw_breakpoint.h>
#include <linux/prefetch.h>
+#include <generated/package.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/system.h>
@@ -32,10 +33,11 @@ void show_regs(struct pt_regs * regs)
{
printk("\n");
printk("Pid : %d, Comm: \t\t%s\n", task_pid_nr(current), current->comm);
- printk("CPU : %d \t\t%s (%s %.*s)\n\n",
+ printk("CPU : %d \t\t%s (%s %.*s%s)\n\n",
smp_processor_id(), print_tainted(), init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ LINUX_PACKAGE_ID);
print_symbol("PC is at %s\n", instruction_pointer(regs));
print_symbol("PR is at %s\n", regs->pr);