14
0
forked from pool/crash
Files
crash/crash-compressed-booted-kernel.patch
David Mair b82c22654a Accepting request 1112906 from home:dmair:branches:Kernel:kdump:crash-1190434
- On initialization crash verifies the core based on the text
  referenced by the linux_banner symbol in the supplied core. It
  chooses how to get the address of the text based on the symbol
  type decoded with gdb. For some compressed kernels with an
  accessible debuginfo file the type is not supported (bss segment
  found, data reference expected) but the symbol and it's value are
  valid. This causes the linux_banner text to be used as the
  "address" of the linux_banner and that's an invalid address for
   the coredump causing crash to fail to load reporting something
  like:
  WARNING: invalid linux_banner pointer: 65762078756e694c
  where the address is obviously ASCII text used as a number. A
  SUSE patch to support compressed kernel binaries introduces the
  behavior, it does not happen for upstream crash source as-is. The
  difference is whether the symbol details are obtained from the
  kernel binary or debuginfo (fails for some debuginfos).
  * crash-get-linux_banner-without-using-syment-type.patch
  In verify_version(), choose how to obtain the linux_banner address
  based on the result of get_symbol_type() instead. TYPE_CODE_ARRAY
  causes the value of the symbol obtained from gdb to be used.
  TYPE_CODE_PTR causes the sybol data to be read to get the address.
  Default is unrecognized type but a warning is shown and the value
  obtained from gdb used as a best case choice.
  (bsc#1190434 c#24)

OBS-URL: https://build.opensuse.org/request/show/1112906
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/crash?expand=0&rev=384
2023-09-22 16:02:04 +00:00

73 lines
1.8 KiB
Diff

From: Petr Tesarik <ptesarik@suse.cz>
Subject: Automatically detect compressed booted kernel
References: bnc#777516, bnc#828260
Upstream: not yet
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
filesys.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
Index: b/filesys.c
===================================================================
--- a/filesys.c
+++ b/filesys.c
@@ -588,6 +588,7 @@ static int
find_booted_kernel(void)
{
char kernel[BUFSIZE];
+ char *real_kernel;
char buffer[BUFSIZE];
char **searchdirs;
int i, preferred, wrapped;
@@ -637,16 +638,24 @@ find_booted_kernel(void)
sprintf(kernel, "%s%s", searchdirs[i], dp->d_name);
if (mount_point(kernel) ||
- !file_readable(kernel) ||
- !is_kernel(kernel))
+ !file_readable(kernel))
continue;
+ if (!is_compressed_kernel(kernel, &real_kernel))
+ real_kernel = kernel;
+
if (CRASHDEBUG(1))
fprintf(fp, "find_booted_kernel: check: %s\n",
kernel);
- found = match_file_string(kernel, kt->proc_version, buffer);
-
+ if (!is_kernel(real_kernel)) {
+ if (real_kernel != kernel)
+ free(real_kernel);
+ continue;
+ }
+
+ found = match_file_string(real_kernel, kt->proc_version, buffer);
+
if (found)
break;
}
@@ -666,10 +675,19 @@ find_booted_kernel(void)
if (CRASHDEBUG(1))
fprintf(fp, "find_booted_kernel: found: %s\n",
pc->namelist);
+ if (real_kernel != kernel) {
+ pc->namelist_orig = pc->namelist;
+ pc->namelist = real_kernel;
+ }
return TRUE;
}
}
+ if (real_kernel != kernel) {
+ remove(real_kernel);
+ free(real_kernel);
+ }
+
error(INFO,
"cannot find booted kernel -- please enter namelist argument\n\n");
return FALSE;