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)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 8 May 2023 20:16:50 +0000 (21:16 +0100)
Forwarded: not-needed

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
lib/dump_stack.c

index a5cfcd0a85a9e2e15e6eb7fb7648c8c52be5fd02..5c2966926a2e6f7acb13c48cf8b944680cbd4726 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1282,7 +1282,8 @@ PHONY += prepare archprepare
 
 archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
        asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
-       include/generated/compile.h include/generated/autoconf.h remove-stale-files
+       include/generated/compile.h include/generated/autoconf.h \
+       include/generated/package.h remove-stale-files
 
 prepare0: archprepare
        $(Q)$(MAKE) $(build)=scripts/mod
@@ -1340,6 +1341,16 @@ define filechk_version.h
        echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL)
 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): PATCHLEVEL := $(or $(PATCHLEVEL), 0)
 $(version_h): SUBLEVEL := $(or $(SUBLEVEL), 0)
 $(version_h): FORCE
@@ -1354,6 +1365,9 @@ filechk_compile.h = $(srctree)/scripts/mkcompile_h \
 include/generated/compile.h: FORCE
        $(call filechk,compile.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 416305e550e281831400caddb7db289b880d97e4..ef88a6712843642b5b3f66f1ff9676a7104a118a 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/utsname.h>
 #include <linux/resume_user_mode.h>
 #include <linux/rcupdate.h>
+#include <generated/package.h>
 
 #include <asm/cpu.h>
 #include <asm/delay.h>
@@ -102,9 +103,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);
        printk("ip is at %pS\n", (void *)ip);
        printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
               regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
index 67da147fe34dc5cf2558f6304f87b8c20d0f3d45..dc31fdd6cb9ef8d65a639f09385b69cb8f1b4144 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/uaccess.h>
 #include <linux/pkeys.h>
 #include <linux/seq_buf.h>
+#include <generated/package.h>
 
 #include <asm/interrupt.h>
 #include <asm/io.h>
@@ -1520,8 +1521,9 @@ static void __show_regs(struct pt_regs *regs)
 
        printk("NIP:  "REG" LR: "REG" CTR: "REG"\n",
               regs->nip, regs->link, regs->ctr);
-       printk("REGS: %px TRAP: %04lx   %s  (%s)\n",
-              regs, regs->trap, print_tainted(), init_utsname()->release);
+       printk("REGS: %px 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);
        pr_cont("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
index ef1eb4f4f6126daf316c99e5a9a13e5bd1ccb4de..a09c4e36118cd7728d0d2047d93f72ea164baca2 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
 #include <linux/utsname.h>
+#include <generated/package.h>
 #include <asm/current.h>
 #include <asm/ptrace.h>
 #include <asm/sysrq.h>
@@ -17,8 +18,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:%pS\n", PT_REGS_CS(regs) & 0xffff,
               (void *)PT_REGS_IP(regs));
        printk(KERN_INFO "RSP: %016lx  EFLAGS: %08lx\n", PT_REGS_SP(regs),
index c71889f3f3fc23ca7da3215caa5f5a4e69e7a41c..784c37561224dc4de2568b3c5c6c9e4558cb5799 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/sched/sysctl.h>
 
 #include <trace/events/sched.h>
+#include <generated/package.h>
 
 /*
  * The number of tasks checked:
@@ -131,10 +132,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, (jiffies - t->last_switch_time) / HZ);
-               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 83471e81501a7249306ef62e173c4dce7960adc7..ad4e7fb21a8c89eeae53bc43d8f09d643784eaa4 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/kexec.h>
 #include <linux/utsname.h>
 #include <linux/stop_machine.h>
+#include <generated/package.h>
 
 static char dump_stack_arch_desc_str[128];
 
@@ -54,13 +55,15 @@ 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 %.*s" BUILD_ID_FMT "\n",
+       printk("%sCPU: %d PID: %d Comm: %.20s %s%s %s %.*s %s" BUILD_ID_FMT "\n",
               log_lvl, raw_smp_processor_id(), current->pid, current->comm,
               kexec_crash_loaded() ? "Kdump: loaded " : "",
               print_tainted(),
               init_utsname()->release,
               (int)strcspn(init_utsname()->version, " "),
-              init_utsname()->version, BUILD_ID_VAL);
+              init_utsname()->version,
+              LINUX_PACKAGE_ID,
+              BUILD_ID_VAL);
 
        if (dump_stack_arch_desc_str[0] != '\0')
                printk("%sHardware name: %s\n",