Thread (14 messages) 14 messages, 5 authors, 2024-07-17

Re: [PATCH v2] printk: Add a short description string to kmsg_dump()

From: Kees Cook <kees@kernel.org>
Date: 2024-07-02 20:29:27
Also in: dri-devel, linux-hardening, linux-hyperv, lkml

On Tue, Jul 02, 2024 at 02:26:04PM +0200, Jocelyn Falempe wrote:
kmsg_dump doesn't forward the panic reason string to the kmsg_dumper
callback.
This patch adds a new struct kmsg_dump_detail, that will hold the
reason and description, and pass it to the dump() callback.
Thanks! I like this much better. :)
To avoid updating all kmsg_dump() call, it adds a kmsg_dump_desc()
function and a macro for backward compatibility.

I've written this for drm_panic, but it can be useful for other
kmsg_dumper.
It allows to see the panic reason, like "sysrq triggered crash"
or "VFS: Unable to mount root fs on xxxx" on the drm panic screen.

v2:
 * Use a struct kmsg_dump_detail to hold the reason and description
   pointer, for more flexibility if we want to add other parameters.
   (Kees Cook)
 * Fix powerpc/nvram_64 build, as I didn't update the forward
   declaration of oops_to_nvram()
The versioning history commonly goes after the "---".
quoted hunk ↗ jump to hunk
[...]
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 906521c2329c..65f5a47727bc 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -39,6 +39,17 @@ struct kmsg_dump_iter {
 	u64	next_seq;
 };
 
+/**
+ *struct kmsg_dump_detail - kernel crash detail
Is kern-doc happy with this? I think there is supposed to be a space
between the "*" and the first word:

 /**
  * struct kmsg...


Otherwise looks good to me!

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help