Fix warning about kernel version inconsistency during crash startup
Upstream commits: aa5763800d61 ("Fix warning about kernel version inconsistency during crash startup") c74f375e0ef7 ("Fix get_linux_banner_from_vmlinux() for vmlinux without ".rodata" symbol") Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
parent
1bab7cdb56
commit
3bbfb1a0bf
@ -0,0 +1,49 @@
|
|||||||
|
From aa5763800d614ff6080fd1909517a3939c250e86 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
Date: Fri, 21 Jul 2023 12:36:18 +0800
|
||||||
|
Subject: [PATCH 1/2] Fix warning about kernel version inconsistency during
|
||||||
|
crash startup
|
||||||
|
|
||||||
|
Currently, the symbol ".rodata" may not be found in some vmlinux, and
|
||||||
|
the strings command will still be used to get the linux banner string,
|
||||||
|
but this gets two strings as below:
|
||||||
|
|
||||||
|
# strings vmlinux | grep "Linux version"
|
||||||
|
Linux version 6.5.0-0.rc2.17.fc39.x86_64 ... GNU ld version 2.40-9.fc39) # SMP PREEMPT_DYNAMIC
|
||||||
|
Linux version 6.5.0-0.rc2.17.fc39.x86_64 ... GNU ld version 2.40-9.fc39) #1 SMP PREEMPT_DYNAMIC Mon Jul 17 14:57:35 UTC 2023
|
||||||
|
|
||||||
|
In the verify_namelist(), the while-loop will only determine if the
|
||||||
|
first linux banner string above matches and break the loop. But actually
|
||||||
|
the second string above is correct one. Eventually, crash starts up with
|
||||||
|
the following warning:
|
||||||
|
|
||||||
|
# ./crash -s vmlinux vmcore
|
||||||
|
WARNING: kernel version inconsistency between vmlinux and dumpfile
|
||||||
|
|
||||||
|
# ./crash -s
|
||||||
|
WARNING: kernel version inconsistency between vmlinux and live memory
|
||||||
|
|
||||||
|
Let's always try to match the correct one, otherwise still prints a
|
||||||
|
warning as before.
|
||||||
|
|
||||||
|
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
---
|
||||||
|
kernel.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kernel.c b/kernel.c
|
||||||
|
index 546eed95eebd..9801812387bd 100644
|
||||||
|
--- a/kernel.c
|
||||||
|
+++ b/kernel.c
|
||||||
|
@@ -1375,8 +1375,6 @@ verify_namelist()
|
||||||
|
buffer3[i++] = *p1++;
|
||||||
|
buffer3[i] = NULLCHAR;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- break;
|
||||||
|
}
|
||||||
|
pclose(pipe);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
From c74f375e0ef7cd9b593fa1d73c47505822c8f2a0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||||
|
Date: Mon, 24 Jul 2023 17:25:12 +0900
|
||||||
|
Subject: [PATCH 2/2] Fix get_linux_banner_from_vmlinux() for vmlinux without
|
||||||
|
".rodata" symbol
|
||||||
|
|
||||||
|
As written in the previous patch, some recent kernels do not have the
|
||||||
|
".rodata" symbol. As a result, the get_linux_banner_from_vmlinux()
|
||||||
|
returns FALSE and the slower fallback routine is used.
|
||||||
|
|
||||||
|
Use "__start_rodata" symbol if the ".rodata" symbol is not available.
|
||||||
|
|
||||||
|
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||||
|
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
---
|
||||||
|
kernel.c | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kernel.c b/kernel.c
|
||||||
|
index 9801812387bd..2114700eecc8 100644
|
||||||
|
--- a/kernel.c
|
||||||
|
+++ b/kernel.c
|
||||||
|
@@ -11891,8 +11891,13 @@ int get_linux_banner_from_vmlinux(char *buf, size_t size)
|
||||||
|
{
|
||||||
|
struct bfd_section *sect;
|
||||||
|
long offset;
|
||||||
|
+ ulong start_rodata;
|
||||||
|
|
||||||
|
- if (!kernel_symbol_exists(".rodata"))
|
||||||
|
+ if (kernel_symbol_exists(".rodata"))
|
||||||
|
+ start_rodata = symbol_value(".rodata");
|
||||||
|
+ else if (kernel_symbol_exists("__start_rodata"))
|
||||||
|
+ start_rodata = symbol_value("__start_rodata");
|
||||||
|
+ else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
sect = bfd_get_section_by_name(st->bfd, ".rodata");
|
||||||
|
@@ -11905,7 +11910,7 @@ int get_linux_banner_from_vmlinux(char *buf, size_t size)
|
||||||
|
* value in vmlinux file, but relative offset to linux_banner
|
||||||
|
* object in .rodata section is idential.
|
||||||
|
*/
|
||||||
|
- offset = symbol_value("linux_banner") - symbol_value(".rodata");
|
||||||
|
+ offset = symbol_value("linux_banner") - start_rodata;
|
||||||
|
|
||||||
|
if (!bfd_get_section_contents(st->bfd,
|
||||||
|
sect,
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -39,6 +39,8 @@ Patch18: 0017-vmware-Improve-output-when-we-fail-to-read-vmware-vm.patch
|
|||||||
Patch19: 0018-Exclude-zero-entries-from-do_maple_tree-return-value.patch
|
Patch19: 0018-Exclude-zero-entries-from-do_maple_tree-return-value.patch
|
||||||
Patch20: 0019-Fix-irq-a-s-options-on-Linux-6.5-rc1-and-later.patch
|
Patch20: 0019-Fix-irq-a-s-options-on-Linux-6.5-rc1-and-later.patch
|
||||||
Patch21: 0020-Fix-segmentation-fault-by-tree-s-option-with-Maple-T.patch
|
Patch21: 0020-Fix-segmentation-fault-by-tree-s-option-with-Maple-T.patch
|
||||||
|
Patch22: 0021-Fix-warning-about-kernel-version-inconsistency-durin.patch
|
||||||
|
Patch23: 0022-Fix-get_linux_banner_from_vmlinux-for-vmlinux-withou.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The core analysis suite is a self-contained tool that can be used to
|
The core analysis suite is a self-contained tool that can be used to
|
||||||
@ -80,6 +82,8 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
|
|||||||
%patch19 -p1
|
%patch19 -p1
|
||||||
%patch20 -p1
|
%patch20 -p1
|
||||||
%patch21 -p1
|
%patch21 -p1
|
||||||
|
%patch22 -p1
|
||||||
|
%patch23 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user