The log command printed a couple of empty lines (only timestamps), which
was caused by the commit  99bb57ac98af ("Enable resolving mangled Rust
symbol in lockless ring buffer"), E.g:

  $ diff -u log.pre log.cur
  --- log.pre     2025-09-16 13:14:31.022206514 +0900
  +++ log.cur     2025-09-16 13:14:56.220390987 +0900
  @@ -210,7 +210,7 @@
    [    0.169375] clocksource: jiffies: mask: 0xffffffff max_cycles: 
0xffffffff, max_idle_ns: 1911260446275000 ns
    [    0.169375] futex hash table entries: 1024 (order: 4, 65536 bytes, 
linear)
    [    0.169375] pinctrl core: initialized pinctrl subsystem
   -[    0.172925] NET: Registered PF_NETLINK/PF_ROUTE protocol family
   +[    0.172925]
    [    0.172983] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic 
allocations
    [    0.172986] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic 
allocations
    [    0.172988] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for 
atomic allocations
  @@ -807,7 +807,7 @@
    [771438.513231]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
    [771438.513423] RIP: 0033:0x7fbd9f8fda57
    [771438.513576] Code: 0f 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 
00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 
00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
   -[771438.514251] RSP: 002b:00007ffee0de2b98 EFLAGS: 00000246 ORIG_RAX: 
0000000000000001
   +[771438.514251]
    [771438.514534] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 
00007fbd9f8fda57
    [771438.514800] RDX: 0000000000000002 RSI: 00005647ccc0a330 RDI: 
0000000000000001
    [771438.515066] RBP: 00005647ccc0a330 R08: 0000000000000003 R09: 
0000000000000000

This is because the strchrnul() returns a pointer to the null byte
instead NULL if the char to be searched is not in the string. Given
that, let's replace the strchrnul() with the strrchr().

Fixes: 99bb57ac98af ("Enable resolving mangled Rust symbol in lockless ring 
buffer")
Reported-by: Kazuhito Hagio <[email protected]>
Signed-off-by: Lianbo Jiang <[email protected]>
---
 printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/printk.c b/printk.c
index ae28c4fa0b21..51b618e2a434 100644
--- a/printk.c
+++ b/printk.c
@@ -221,7 +221,7 @@ dump_record(struct prb_map *m, unsigned long id, int 
msg_flags)
        char *p1 = strstr(buf, "_R");
        if (!p1)
                p1 = strstr(buf, "_ZN");
-       char *p2 = strchrnul(buf, '+');
+       char *p2 = strrchr(buf, '+');
        if (p1 && p2) {
                char mangled[BUFSIZE] = {0};
                char demangled[BUFSIZE] = {0};
-- 
2.50.1
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to