Include package version along with kernel release in stack traces
authorBen Hutchings <ben@decadent.org.uk>
Tue, 24 Jul 2012 02:13:10 +0000 (03:13 +0100)
committerAurelien Jarno <aurel32@debian.org>
Fri, 2 Mar 2018 07:52:22 +0000 (07:52 +0000)
For distribution binary packages we assume
$DISTRIBUTION_OFFICIAL_BUILD, $DISTRIBUTOR and $DISTRIBUTION_VERSION
are set.

Gbp-Pq: Topic debian
Gbp-Pq: Name version.patch

Makefile
arch/ia64/kernel/process.c
arch/powerpc/kernel/process.c
arch/x86/um/sysrq_64.c
kernel/hung_task.c
kernel/printk/printk.c

index a0ff4d526a55c3058aaa6744565405ab90d31160..8a27e6a3591ad1ef0b65f5c7c01beab18cb192fc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1031,7 +1031,7 @@ endif
 prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic
 
 prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
-                   include/config/auto.conf
+                   include/config/auto.conf include/generated/package.h
        $(cmd_crmodverdir)
 
 archprepare: archheaders archscripts prepare1 scripts_basic
@@ -1104,6 +1104,16 @@ define filechk_version.h
        echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
 endef
 
+ifneq ($(DISTRIBUTION_OFFICIAL_BUILD),)
+define filechk_package.h
+       echo \#define LINUX_PACKAGE_ID \" $(DISTRIBUTOR) $(DISTRIBUTION_VERSION)\"
+endef
+else
+define filechk_package.h
+       echo \#define LINUX_PACKAGE_ID \"\"
+endef
+endif
+
 $(version_h): $(srctree)/Makefile FORCE
        $(call filechk,version.h)
        $(Q)rm -f $(old_version_h)
@@ -1111,6 +1121,9 @@ $(version_h): $(srctree)/Makefile FORCE
 include/generated/utsrelease.h: include/config/kernel.release FORCE
        $(call filechk,utsrelease.h)
 
+include/generated/package.h: $(srctree)/Makefile FORCE
+       $(call filechk,package.h)
+
 PHONY += headerdep
 headerdep:
        $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
index aae6c4dc7ae7f5f51a328411af58c94e21c0cd88..6267766bec0cf44484456c874362b0a92173fb32 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/utsname.h>
 #include <linux/tracehook.h>
 #include <linux/rcupdate.h>
+#include <generated/package.h>
 
 #include <asm/cpu.h>
 #include <asm/delay.h>
@@ -103,9 +104,9 @@ show_regs (struct pt_regs *regs)
        print_modules();
        printk("\n");
        show_regs_print_info(KERN_DEFAULT);
-       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);
index 1c141d50fbc6a990ae4f2ce1f8028b5fb0a3ef51..32ee7583327f97980e57b540013acceea2c83992 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/hw_breakpoint.h>
 #include <linux/uaccess.h>
 #include <linux/elf-randomize.h>
+#include <generated/package.h>
 
 #include <asm/pgtable.h>
 #include <asm/io.h>
@@ -1360,8 +1361,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);
        print_msr_bits(regs->msr);
        printk("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
index 38b4e4abd0f836b28ee6596bf2aa2410078a6df4..6bc031d04fe933392ed8cadebad8aa21ba08db3c 100644 (file)
@@ -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 <asm/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_IP(regs));
        printk(KERN_INFO "RSP: %016lx  EFLAGS: %08lx\n", PT_REGS_SP(regs),
index 2b59c82cc3e1bb0813088cf5e22307d81230e13e..e491ad5f65048be82a4b4a4cb6a2557327403ebf 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/sysctl.h>
 #include <linux/utsname.h>
 #include <trace/events/sched.h>
+#include <generated/package.h>
 
 /*
  * The number of tasks checked:
@@ -109,10 +110,11 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
                sysctl_hung_task_warnings--;
                pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
                        t->comm, t->pid, timeout);
-               pr_err("      %s %s %.*s\n",
+               pr_err("      %s %s %.*s%s\n",
                        print_tainted(), init_utsname()->release,
                        (int)strcspn(init_utsname()->version, " "),
-                       init_utsname()->version);
+                       init_utsname()->version,
+                       LINUX_PACKAGE_ID);
                pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
                        " disables this message.\n");
                sched_show_task(t);
index 9c5b231684d01b2bcee505a40d3efe84580c2ad4..829827e32227a5c0c6aa12dba76a84035a19e07d 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/utsname.h>
 #include <linux/ctype.h>
 #include <linux/uio.h>
+#include <generated/package.h>
 
 #include <asm/uaccess.h>
 #include <asm/sections.h>
@@ -3282,11 +3283,12 @@ void __init dump_stack_set_arch_desc(const char *fmt, ...)
  */
 void dump_stack_print_info(const char *log_lvl)
 {
-       printk("%sCPU: %d PID: %d Comm: %.20s %s %s %.*s\n",
+       printk("%sCPU: %d PID: %d Comm: %.20s %s %s %.*s%s\n",
               log_lvl, raw_smp_processor_id(), current->pid, current->comm,
               print_tainted(), init_utsname()->release,
               (int)strcspn(init_utsname()->version, " "),
-              init_utsname()->version);
+              init_utsname()->version,
+              LINUX_PACKAGE_ID);
 
        if (dump_stack_arch_desc_str[0] != '\0')
                printk("%sHardware name: %s\n",