Skip to contentSkip to conversation

powerpc/xmon: make dumping log buffer contents more reliable

PATCH Applied Nathan Lynch 2 participants 2 messages May 14, 2021 – Jun 6, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/xmon: make dumping log buffer contents more reliable

Log buffer entries that are too long for dump_log_buf()'s small local buffer are:

* silently discarded when a single-line entry is too long; kmsg_dump_get_line() returns true but sets &len to 0.
* silently truncated to the last fitting new line when a multi-line entry is too long, e.g. register dumps from __show_regs(); this seems undetectable via the kmsg_dump API.

xmon_printf()'s internal buffer is already 1KB; enlarge dump_log_buf()'s own buffer to match and make it statically allocated. Verified that this allows complete printing of register dumps on ppc64le with both CONFIG_PRINTK_TIME=y and CONFIG_PRINTK_CALLER=y.

---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/xmon/xmon.c +1 -1
index c8173e92f19d..f73c10869e64 100644
@@ -2975,7 +2975,7 @@ static void
 dump_log_buf(void)
 {
 	struct kmsg_dump_iter iter;
-	unsigned char buf[128];
+	static unsigned char buf[1024];
 	size_t len;
 
 	if (setjmp(bus_error_jmp) != 0) {
Signature · 1 line
2.30.2
#1 lore raw
Quoted 10 lines · Nathan Lynch

Log buffer entries that are too long for dump_log_buf()'s small local buffer are:

* silently discarded when a single-line entry is too long; kmsg_dump_get_line() returns true but sets &len to 0.
* silently truncated to the last fitting new line when a multi-line entry is too long, e.g. register dumps from __show_regs(); this seems undetectable via the kmsg_dump API.

[...]

Applied to powerpc/next.

[1/1] powerpc/xmon: make dumping log buffer contents more reliable

      https://git.kernel.org/powerpc/c/2cec178e35baf57d307c0982fd2e53055bd1e9bb

cheers