Fix for 'sys' to properly display the PANIC message

Using 'sys' command, we can view the panic message with general system
information. If we run RISCV64-based vmcore, PANIC message is not properly
displayed.

The reason is that the string "Unable to handle kernel" is not
completely matched with the panic_msg[]. The corresponding kernel commit
is 21733cb518471.

Without the patch:
  crash> sys
        KERNEL: vmlinux  [TAINTED]
      DUMPFILE: vmcore
          CPUS: 4
          DATE: Thu Aug 22 16:13:08 KST 2024
        UPTIME: 00:33:25
  LOAD AVERAGE: 0.07, 0.07, 0.02
         TASKS: 385
      NODENAME: starfive
       RELEASE: 6.6.20+
       VERSION: #13 SMP Mon Aug 19 12:58:52 KST 2024
       MACHINE: riscv64  (unknown Mhz)
        MEMORY: 4 GB
         PANIC: ""

With the patch:
  crash> sys
        KERNEL: vmlinux  [TAINTED]
      DUMPFILE: vmcore
          CPUS: 4
          DATE: Thu Aug 22 16:13:08 KST 2024
        UPTIME: 00:33:25
  LOAD AVERAGE: 0.07, 0.07, 0.02
         TASKS: 385
      NODENAME: starfive
       RELEASE: 6.6.20+
       VERSION: #13 SMP Mon Aug 19 12:58:52 KST 2024
       MACHINE: riscv64  (unknown Mhz)
        MEMORY: 4 GB
         PANIC: "Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000000000"

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
This commit is contained in:
Austin Kim 2024-10-29 17:32:07 +09:00 committed by Lianbo Jiang
parent ca74157283
commit db0077614a

5
task.c
View File

@ -6392,6 +6392,11 @@ get_panicmsg(char *buf)
get_symbol_data("sysrq_pressed", sizeof(int), &msg_found);
break;
}
/*
* Try to search panic string in panic keywords
*/
search_panic_task_by_keywords(buf, &msg_found);
}
found: