On Wed, Nov 19, 2025 at 12:51 PM <devel-request@lists.crash-utility.osci.io> wrote:
Date: Wed, 19 Nov 2025 17:06:32 +1300
From: Tao Liu <ltao@redhat.com>
Subject: [Crash-utility] [PATCH] Revert "vmcoreinfo: read vmcoreinfo
        using 'vmcoreinfo_data' when unavailable in elf note"
To: devel@lists.crash-utility.osci.io
Cc: Tao Liu <ltao@redhat.com>
Message-ID: <20251119040631.19214-2-ltao@redhat.com>
Content-Type: text/plain; charset="US-ASCII"; x-default=true

This patch will cause a regression on some x86_64 vmcores.

    $ crash -s vmcore vmlinux.gz
    WARNING: vmcoreinfo is empty, will read from symbols
    crash: cannot malloc vmcoreinfo buffer
    crash: /var/tmp/vmlinux.gz_fWV3kA and vmcore do not match!

The root cause is, in main.c, is_kdump() calls is_netdump(), which will
set pc->read_vmcoreinfo as vmcoreinfo_read_from_memory(), rather than
original vmcoreinfo_read_string().

Later in machdep_init(PRE_SYMTAB), vmcoreinfo_read_from_memory() doesn't
get "relocate" string, so fails for set kaslr flag, then fails for
linux_banner detection:

    Thread 1 "crash" hit Breakpoint 2, verify_version ():
    1096                if (!IS_KVADDR(linux_banner))
    (gdb) p/x linux_banner
    $4 = 0xffffffff81e00100

    crash> sym linux_banner
    ffffffff9aa00100 (R) linux_banner

As we can see with the patch applied, linux_banner got a wrong address.
So this patch currently is unsafe, and should be reverted before the fix.

Signed-off-by: Tao Liu <ltao@redhat.com>
---

Since it is too close to the new release date of crash utility, I don't
have enough time for full root cause analysis and re-testing. So currently
the best option is to revert it for now, and fix it in the next release then
re-apply.


Agree. Thanks for working on it, Tao. So: Acke
 
Lianbo

---
 defs.h     |  1 -
 diskdump.c | 18 ------------------
 kernel.c   | 17 +++++------------
 netdump.c  | 19 -------------------
 4 files changed, 5 insertions(+), 50 deletions(-)

diff --git a/defs.h b/defs.h
index ab4aee8..ae6ea01 100644
--- a/defs.h
+++ b/defs.h
@@ -6225,7 +6225,6 @@ void dump_kernel_table(int);
 void dump_bt_info(struct bt_info *, char *where);
 void dump_log(int);
 void parse_kernel_version(char *);
-char *vmcoreinfo_read_from_memory(const char *);

 #define LOG_LEVEL(v) ((v) & 0x07)
 #define SHOW_LOG_LEVEL    (0x1)
diff --git a/diskdump.c b/diskdump.c
index de90755..ce3cbb7 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -1041,13 +1041,6 @@ pfn_to_pos(ulong pfn)
        return desc_pos;
 }

-/**
- * Check if vmcoreinfo in vmcore is missing/empty
- */
-static bool is_diskdump_vmcoreinfo_empty(void)
-{
-       return (dd->sub_header_kdump->size_vmcoreinfo == 0);
-}

 /*
  *  Determine whether a file is a diskdump creation, and if TRUE,
@@ -1095,17 +1088,6 @@ is_diskdump(char *file)

        pc->read_vmcoreinfo = vmcoreinfo_read_string;

-       /*
-        * vmcoreinfo can be empty in case of dump collected via virsh-dump
-        *
-        * check if vmcoreinfo is not available in vmcore, and try to read
-        * the vmcoreinfo from memory, using "vmcoreinfo_data" symbol
-        */
-       if (is_diskdump_vmcoreinfo_empty()) {
-               error(WARNING, "vmcoreinfo is empty, will read from symbols\n");
-               pc->read_vmcoreinfo = vmcoreinfo_read_from_memory;
-       }
-
        if ((pc->flags2 & GET_LOG) && KDUMP_CMPRS_VALID()) {
                pc->dfd = dd->dfd;
                pc->readmem = read_diskdump;
diff --git a/kernel.c b/kernel.c
index 13f3374..e077275 100644
--- a/kernel.c
+++ b/kernel.c
@@ -99,6 +99,7 @@ static ulong dump_audit_skb_queue(ulong);
 static ulong __dump_audit(char *);
 static void dump_audit(void);
 static void dump_printk_safe_seq_buf(int);
+static char *vmcoreinfo_read_string(const char *);
 static void check_vmcoreinfo(void);
 static int is_pvops_xen(void);
 static int get_linux_banner_from_vmlinux(char *, size_t);
@@ -11894,8 +11895,8 @@ dump_printk_safe_seq_buf(int msg_flags)
  * Returns a string (that has to be freed by the caller) that contains the
  * value for key or NULL if the key has not been found.
  */
-char *
-vmcoreinfo_read_from_memory(const char *key)
+static char *
+vmcoreinfo_read_string(const char *key)
 {
        char *buf, *value_string, *p1, *p2;
        size_t value_length;
@@ -11905,14 +11906,6 @@ vmcoreinfo_read_from_memory(const char *key)

        buf = value_string = NULL;

-       if (!(pc->flags & GDB_INIT)) {
-               /*
-                * GDB interface hasn't been initialised yet, so can't
-                * access vmcoreinfo_data
-                */
-               return NULL;
-       }
-
        switch (get_symbol_type("vmcoreinfo_data", NULL, NULL))
        {
        case TYPE_CODE_PTR:
@@ -11968,10 +11961,10 @@ check_vmcoreinfo(void)
                switch (get_symbol_type("vmcoreinfo_data", NULL, NULL))
                {
                case TYPE_CODE_PTR:
-                       pc->read_vmcoreinfo = vmcoreinfo_read_from_memory;
+                       pc->read_vmcoreinfo = vmcoreinfo_read_string;
                        break;
                case TYPE_CODE_ARRAY:
-                       pc->read_vmcoreinfo = vmcoreinfo_read_from_memory;
+                       pc->read_vmcoreinfo = vmcoreinfo_read_string;
                        break;
                }
        }
diff --git a/netdump.c b/netdump.c
index 69100a9..c7ff009 100644
--- a/netdump.c
+++ b/netdump.c
@@ -111,14 +111,6 @@ map_cpus_to_prstatus(void)
        FREEBUF(nt_ptr);
 }

-/**
- * Check if vmcoreinfo in vmcore is missing/empty
- */
-static bool is_netdump_vmcoreinfo_empty(void)
-{
-       return (nd->size_vmcoreinfo == 0);
-}
-
 /*
  *  Determine whether a file is a netdump/diskdump/kdump creation,
  *  and if TRUE, initialize the vmcore_data structure.
@@ -472,17 +464,6 @@ is_netdump(char *file, ulong source_query)

        pc->read_vmcoreinfo = vmcoreinfo_read_string;

-       /*
-        * vmcoreinfo can be empty in case of dump collected via virsh-dump
-        *
-        * check if vmcoreinfo is not available in vmcore, and try to read
-        * the vmcoreinfo from memory, using "vmcoreinfo_data" symbol
-        */
-       if (is_netdump_vmcoreinfo_empty()) {
-               error(WARNING, "vmcoreinfo is empty, will read from symbols\n");
-               pc->read_vmcoreinfo = vmcoreinfo_read_from_memory;
-       }
-
        if ((source_query == KDUMP_LOCAL) &&
            (pc->flags2 & GET_OSRELEASE))
                kdump_get_osrelease();
--
2.47.0