From 2f183c68345a26213e5e7f798399bee68d1c4a97 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Fri, 31 May 2024 12:04:57 +0300 Subject: kernel/panic: add verbose logging of kernel taints in backtraces With nearly 20 taint flags and respective characters, it's getting a bit difficult to remember what each taint flag character means. Add verbose logging of the set taints in the format: Tainted: [P]=PROPRIETARY_MODULE, [W]=WARN in dump_stack_print_info() when there are taints. Note that the "negative flag" G is not included. Link: https://lkml.kernel.org/r/7321e306166cb2ca2807ab8639e665baa2462e9c.1717146197.git.jani.nikula@intel.com Signed-off-by: Jani Nikula Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andrew Morton --- lib/dump_stack.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/dump_stack.c') diff --git a/lib/dump_stack.c b/lib/dump_stack.c index 222c6d6c8281..8b6b70eaf949 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c @@ -62,6 +62,9 @@ void dump_stack_print_info(const char *log_lvl) (int)strcspn(init_utsname()->version, " "), init_utsname()->version, BUILD_ID_VAL); + if (get_taint()) + printk("%s%s\n", log_lvl, print_tainted_verbose()); + if (dump_stack_arch_desc_str[0] != '\0') printk("%sHardware name: %s\n", log_lvl, dump_stack_arch_desc_str); -- cgit From d2917ff19962951399bc33f596648836cc5a0be4 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Fri, 14 Jun 2024 21:13:58 -0700 Subject: lib/dump_stack: report process UID in dump_stack_print_info() To make it easier to identify the crashing process, report effective UID when dumping the stack. Link: https://lkml.kernel.org/r/20240615041358.103791-1-surenb@google.com Signed-off-by: Suren Baghdasaryan Signed-off-by: Andrew Morton --- lib/dump_stack.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/dump_stack.c') diff --git a/lib/dump_stack.c b/lib/dump_stack.c index 8b6b70eaf949..1a996fbbf50a 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c @@ -54,8 +54,10 @@ 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", - log_lvl, raw_smp_processor_id(), current->pid, current->comm, + printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s" BUILD_ID_FMT "\n", + log_lvl, raw_smp_processor_id(), + __kuid_val(current_real_cred()->euid), + current->pid, current->comm, kexec_crash_loaded() ? "Kdump: loaded " : "", print_tainted(), init_utsname()->release, -- cgit