1
0
forked from kernel-kdump/crash
Files
crash/crash-debuginfo-compressed.patch

68 lines
2.1 KiB
Diff
Raw Permalink Normal View History

From: Petr Tesarik <ptesarik@suse.cz>
Subject: Search debuginfo files in the original directory
References: bnc#723639
If debuginfo is in a separate file and the kernel image is compressed,
then it should be found in the same directory as the original (compressed)
image, not in the directory with the uncompressed image (TMPDIR).
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
symbols.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
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
Index: b/symbols.c
===================================================================
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
--- a/symbols.c
+++ b/symbols.c
@@ -240,9 +240,9 @@ symtab_init(void)
* Pull a bait-and-switch on st->bfd if we've got a separate
* .gnu_debuglink file that matches the CRC. Not done for kerntypes.
*/
- if (!(LKCD_KERNTYPES()) &&
- !(bfd_get_file_flags(st->bfd) & HAS_SYMS)) {
- if (!check_gnu_debuglink(st->bfd))
+ if (!(LKCD_KERNTYPES())) {
+ if (!check_gnu_debuglink(st->bfd) &&
+ !(bfd_get_file_flags(st->bfd) & HAS_SYMS))
no_debugging_data(FATAL);
}
@@ -304,13 +304,16 @@ check_gnu_debuglink(bfd *bfd)
char *contents;
int crc_offset;
unsigned long crc32;
+ char *namelist;
char *dirname;
char *namelist_debug;
char **matching;
+ namelist = pc->namelist_orig ? pc->namelist_orig : pc->namelist;
+
sect = bfd_get_section_by_name(bfd, ".gnu_debuglink");
if (!sect) {
- error(INFO, "%s: no .gnu_debuglink section\n", pc->namelist);
+ error(INFO, "%s: no .gnu_debuglink section\n", namelist);
return FALSE;
}
@@ -331,14 +334,14 @@ check_gnu_debuglink(bfd *bfd)
contents, crc32);
if ((pc->debuginfo_file = (char *)
- malloc(((strlen(pc->namelist) + strlen("/.debug/") +
+ malloc(((strlen(namelist) + strlen("/.debug/") +
+ strlen(".debug") + strlen(" /usr/lib/debug/boot/ "))*10)
+ strlen(pc->namelist_debug ? pc->namelist_debug : " "))) == NULL)
error(FATAL, "debuginfo file name malloc: %s\n",
strerror(errno));
- dirname = GETBUF(strlen(pc->namelist)+1);
- strcpy(dirname, pc->namelist);
+ dirname = GETBUF(strlen(namelist)+1);
+ strcpy(dirname, namelist);
for (i = strlen(dirname)-1; i >= 0; i--)
{