Update to the latest upstream: commit <8dfc228b29ae>
Release crash-7.2.9-6 Resolves: rhbz#1895255 Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
parent
77119010d2
commit
d33f440f04
@ -0,0 +1,69 @@
|
||||
From f7e7d0303f63393cf9e7830d63b7fabfe5c7cb13 Mon Sep 17 00:00:00 2001
|
||||
From: John Pittman <jpittman@redhat.com>
|
||||
Date: Mon, 15 Mar 2021 17:07:57 -0400
|
||||
Subject: [PATCH 01/11] struct: fix struct print member array of list_heads
|
||||
|
||||
Due to the way that an array of list_head entries are printed,
|
||||
parsing of them fails. Note the difference in spacing between the
|
||||
double opening and double closing brackets.
|
||||
|
||||
crash> struct blk_mq_ctx.rq_lists ffffc447ffc0f740
|
||||
<-->rq_lists = {{
|
||||
next = 0xffffc447ffc0f748,
|
||||
prev = 0xffffc447ffc0f748
|
||||
}, {
|
||||
next = 0xffffc447ffc0f758,
|
||||
prev = 0xffffc447ffc0f758
|
||||
}, {
|
||||
next = 0xffffc447ffc0f768,
|
||||
prev = 0xffffc447ffc0f768
|
||||
<---->}}
|
||||
|
||||
As parse_for_member() relies on opening and closing brackets having
|
||||
the same spacing, make a condition for these arrays of list_head
|
||||
members.
|
||||
|
||||
Before:
|
||||
|
||||
crash> struct blk_mq_ctx.rq_completed ffffc447ffc0f740
|
||||
crash>
|
||||
|
||||
After:
|
||||
|
||||
crash> struct blk_mq_ctx.rq_completed ffffc447ffc0f740
|
||||
rq_completed = {221, 1333}
|
||||
|
||||
Signed-off-by: John Pittman <jpittman@redhat.com>
|
||||
---
|
||||
symbols.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index 215d523fb325..a2d5c6c6178f 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -7918,7 +7918,8 @@ parse_for_member(struct datatype_member *dm, ulong flag)
|
||||
sprintf(lookfor2, " %s[", s);
|
||||
next_item:
|
||||
while (fgets(buf, BUFSIZE, pc->tmpfile)) {
|
||||
- if (embed && (count_leading_spaces(buf) == embed))
|
||||
+ if ((embed && (count_leading_spaces(buf) == embed)) ||
|
||||
+ (strstr(buf, "}}") && embed == count_leading_spaces(buf) - 2))
|
||||
embed = 0;
|
||||
|
||||
if (!on && !embed && strstr(buf, "= {") && !strstr(buf, lookfor1))
|
||||
@@ -7940,6 +7941,11 @@ next_item:
|
||||
!strstr(buf, "}")) || (buf[0] == '}')) {
|
||||
break;
|
||||
}
|
||||
+ if (indent && (on > 1) && indent == count_leading_spaces(buf) - 2 &&
|
||||
+ strstr(buf, "}}")) {
|
||||
+ fprintf(pc->saved_fp, "%s", buf);
|
||||
+ break;
|
||||
+ }
|
||||
if (!indent) {
|
||||
if ((p1 = strstr(buf, ", \n")))
|
||||
sprintf(p1, "\n");
|
||||
--
|
||||
2.29.2
|
||||
|
42
0021-Do-not-pass-through-the-sy-command-to-GDB.patch
Normal file
42
0021-Do-not-pass-through-the-sy-command-to-GDB.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From f30c5075de1b2600240d3613f78f0ab5c495a7f2 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Wed, 17 Mar 2021 21:32:59 +0800
|
||||
Subject: [PATCH 02/11] Do not pass through the 'sy' command to GDB
|
||||
|
||||
The GDB 'symbol-file' command is prohibited in the crash utility, but
|
||||
an abbreviation of it, the 'sy' is not prohibited. This can discard
|
||||
symbol table from the current symbol file, and eventually caused the
|
||||
failure of crash utility after executing the 'sys' command as below:
|
||||
|
||||
crash> sy
|
||||
Discard symbol table from `/usr/lib/debug/usr/lib/modules/5.11.0-2.el9.x86_64/vmlinux'? (y or n) Please answer y or n.
|
||||
Discard symbol table from `/usr/lib/debug/usr/lib/modules/5.11.0-2.el9.x86_64/vmlinux'? (y or n) No symbol file now.
|
||||
crash> sys
|
||||
double free or corruption (!prev)
|
||||
Aborted (core dumped)
|
||||
|
||||
To prevent the abort, add the 'sy' command to the prohibited list so
|
||||
that the crash utility does not pass it directly to GDB.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
gdb_interface.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb_interface.c b/gdb_interface.c
|
||||
index f4f4dd3993db..1f10006a2d63 100644
|
||||
--- a/gdb_interface.c
|
||||
+++ b/gdb_interface.c
|
||||
@@ -702,7 +702,7 @@ static char *prohibited_list[] = {
|
||||
"clear", "disable", "enable", "condition", "ignore", "frame",
|
||||
"select-frame", "f", "up", "down", "catch", "tcatch", "return",
|
||||
"file", "exec-file", "core-file", "symbol-file", "load", "si", "ni",
|
||||
- "shell",
|
||||
+ "shell", "sy",
|
||||
NULL /* must be last */
|
||||
};
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
178
0022-diskdump-zram-cleanup-try_zram_decompress.patch
Normal file
178
0022-diskdump-zram-cleanup-try_zram_decompress.patch
Normal file
@ -0,0 +1,178 @@
|
||||
From 8ffcccf73936930e04296e45f191b26b89676178 Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:44 +0900
|
||||
Subject: [PATCH 03/11] diskdump, zram: cleanup try_zram_decompress()
|
||||
|
||||
This clean up makes later commits a bit readable.
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
diskdump.c | 143 +++++++++++++++++++++++++++--------------------------
|
||||
1 file changed, 73 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 4f1459638ae8..9485f307b350 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2749,85 +2749,88 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
sizeof(void *), "block_device_bd_disk", FAULT_ON_ERROR);
|
||||
readmem(bd_disk + OFFSET(gendisk_disk_name), KVADDR, name,
|
||||
strlen("zram"), "gendisk_disk_name", FAULT_ON_ERROR);
|
||||
- if (!strncmp(name, "zram", strlen("zram"))) {
|
||||
+
|
||||
+ if (strncmp(name, "zram", strlen("zram"))) {
|
||||
if (CRASHDEBUG(2))
|
||||
- error(WARNING, "this page has swapped to zram\n");
|
||||
-
|
||||
- readmem(bd_disk + OFFSET(gendisk_private_data), KVADDR, &zram,
|
||||
- sizeof(void *), "gendisk_private_data", FAULT_ON_ERROR);
|
||||
-
|
||||
- readmem(zram + OFFSET(zram_compressor), KVADDR, name,
|
||||
- sizeof(name), "zram compressor", FAULT_ON_ERROR);
|
||||
- if (STREQ(name, "lzo")) {
|
||||
- if (!(dd->flags & LZO_SUPPORTED)) {
|
||||
- if (lzo_init() == LZO_E_OK)
|
||||
- dd->flags |= LZO_SUPPORTED;
|
||||
- else
|
||||
- return 0;
|
||||
- }
|
||||
- decompressor = (void *)lzo1x_decompress_safe;
|
||||
- } else {//todo,support more compressor
|
||||
- error(WARNING, "only the lzo compressor is supported\n");
|
||||
- return 0;
|
||||
- }
|
||||
+ error(WARNING, "this page has been swapped to %s\n", name);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- if (THIS_KERNEL_VERSION >= LINUX(2, 6, 0)) {
|
||||
- swp_offset = (ulonglong)__swp_offset(pte_val);
|
||||
- } else {
|
||||
- swp_offset = (ulonglong)SWP_OFFSET(pte_val);
|
||||
- }
|
||||
+ if (CRASHDEBUG(2))
|
||||
+ error(WARNING, "this page has swapped to zram\n");
|
||||
|
||||
- zram_buf = (unsigned char *)GETBUF(PAGESIZE());
|
||||
- /*lookup page from swap cache*/
|
||||
- obj_addr = lookup_swap_cache(pte_val, zram_buf);
|
||||
- if (obj_addr != NULL) {
|
||||
- memcpy(buf, obj_addr + off, len);
|
||||
- goto out;
|
||||
- }
|
||||
+ readmem(bd_disk + OFFSET(gendisk_private_data), KVADDR, &zram,
|
||||
+ sizeof(void *), "gendisk_private_data", FAULT_ON_ERROR);
|
||||
|
||||
- sector = swp_offset << (PAGESHIFT() - 9);
|
||||
- index = sector >> SECTORS_PER_PAGE_SHIFT;
|
||||
- readmem(zram, KVADDR, &zram_table_entry,
|
||||
- sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
|
||||
- zram_table_entry += (index * SIZE(zram_table_entry));
|
||||
- readmem(zram_table_entry, KVADDR, &entry,
|
||||
- sizeof(void *), "entry of table", FAULT_ON_ERROR);
|
||||
- readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
|
||||
- sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
|
||||
- if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
|
||||
- memset(buf, entry, len);
|
||||
- goto out;
|
||||
- }
|
||||
- size = flags & (ZRAM_FLAG_SHIFT -1);
|
||||
- if (size == 0) {
|
||||
- len = 0;
|
||||
- goto out;
|
||||
+ readmem(zram + OFFSET(zram_compressor), KVADDR, name,
|
||||
+ sizeof(name), "zram compressor", FAULT_ON_ERROR);
|
||||
+ if (STREQ(name, "lzo")) {
|
||||
+ if (!(dd->flags & LZO_SUPPORTED)) {
|
||||
+ if (lzo_init() == LZO_E_OK)
|
||||
+ dd->flags |= LZO_SUPPORTED;
|
||||
+ else
|
||||
+ return 0;
|
||||
}
|
||||
+ decompressor = (void *)lzo1x_decompress_safe;
|
||||
+ } else { /* todo: support more compressor */
|
||||
+ error(WARNING, "only the lzo compressor is supported\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- readmem(zram + OFFSET(zram_mempoll), KVADDR, &zram,
|
||||
- sizeof(void *), "zram_mempoll", FAULT_ON_ERROR);
|
||||
+ if (THIS_KERNEL_VERSION >= LINUX(2, 6, 0)) {
|
||||
+ swp_offset = (ulonglong)__swp_offset(pte_val);
|
||||
+ } else {
|
||||
+ swp_offset = (ulonglong)SWP_OFFSET(pte_val);
|
||||
+ }
|
||||
|
||||
- obj_addr = zram_object_addr(zram, entry, zram_buf);
|
||||
- if (obj_addr == NULL) {
|
||||
- len = 0;
|
||||
- goto out;
|
||||
- }
|
||||
+ zram_buf = (unsigned char *)GETBUF(PAGESIZE());
|
||||
+ /* lookup page from swap cache */
|
||||
+ obj_addr = lookup_swap_cache(pte_val, zram_buf);
|
||||
+ if (obj_addr != NULL) {
|
||||
+ memcpy(buf, obj_addr + off, len);
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
- if (size == PAGESIZE()) {
|
||||
- memcpy(buf, obj_addr + off, len);
|
||||
- } else {
|
||||
- outbuf = (unsigned char *)GETBUF(PAGESIZE());
|
||||
- outsize = PAGESIZE();
|
||||
- if (!decompressor(obj_addr, size, outbuf, &outsize, NULL))
|
||||
- memcpy(buf, outbuf + off, len);
|
||||
- else {
|
||||
- error(WARNING, "zram decompress error\n");
|
||||
- len = 0;
|
||||
- }
|
||||
- FREEBUF(outbuf);
|
||||
- }
|
||||
+ sector = swp_offset << (PAGESHIFT() - 9);
|
||||
+ index = sector >> SECTORS_PER_PAGE_SHIFT;
|
||||
+ readmem(zram, KVADDR, &zram_table_entry,
|
||||
+ sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
|
||||
+ zram_table_entry += (index * SIZE(zram_table_entry));
|
||||
+ readmem(zram_table_entry, KVADDR, &entry,
|
||||
+ sizeof(void *), "entry of table", FAULT_ON_ERROR);
|
||||
+ readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
|
||||
+ sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
|
||||
+ if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
|
||||
+ memset(buf, entry, len);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ size = flags & (ZRAM_FLAG_SHIFT -1);
|
||||
+ if (size == 0) {
|
||||
+ len = 0;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ readmem(zram + OFFSET(zram_mempoll), KVADDR, &zram,
|
||||
+ sizeof(void *), "zram_mempoll", FAULT_ON_ERROR);
|
||||
+
|
||||
+ obj_addr = zram_object_addr(zram, entry, zram_buf);
|
||||
+ if (obj_addr == NULL) {
|
||||
+ len = 0;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (size == PAGESIZE()) {
|
||||
+ memcpy(buf, obj_addr + off, len);
|
||||
} else {
|
||||
- return 0;
|
||||
+ outbuf = (unsigned char *)GETBUF(PAGESIZE());
|
||||
+ outsize = PAGESIZE();
|
||||
+ if (!decompressor(obj_addr, size, outbuf, &outsize, NULL))
|
||||
+ memcpy(buf, outbuf + off, len);
|
||||
+ else {
|
||||
+ error(WARNING, "zram decompress error\n");
|
||||
+ len = 0;
|
||||
+ }
|
||||
+ FREEBUF(outbuf);
|
||||
}
|
||||
|
||||
out:
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 5fa11f3a32dac8398c3b917451b657d7b35bc36d Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:45 +0900
|
||||
Subject: [PATCH 04/11] diskdump, zram: initialize zram symbol information when
|
||||
needed
|
||||
|
||||
In the current code, symbol information related to zram is initialized
|
||||
even when a given disk is not zram. It should be done after the disk
|
||||
turns out to be zram.
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
diskdump.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 9485f307b350..8dda58643f6a 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2725,9 +2725,6 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
unsigned char *zram_buf = NULL;
|
||||
unsigned char *outbuf = NULL;
|
||||
|
||||
- if (INVALID_MEMBER(zram_compressor))
|
||||
- zram_init();
|
||||
-
|
||||
off = PAGEOFFSET(vaddr);
|
||||
if (!symbol_exists("swap_info"))
|
||||
return 0;
|
||||
@@ -2756,6 +2753,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (INVALID_MEMBER(zram_compressor))
|
||||
+ zram_init();
|
||||
+
|
||||
if (CRASHDEBUG(2))
|
||||
error(WARNING, "this page has swapped to zram\n");
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,60 @@
|
||||
From c951b82bb3198f435ebfe2af6db8c82f3d905fc6 Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:46 +0900
|
||||
Subject: [PATCH 05/11] diskdump, zram: fix fault error when reading zram disk
|
||||
with no symbol information
|
||||
|
||||
When no zram symbol information is initialized, reading memory swapped
|
||||
out into zram disk results in fault error as follows:
|
||||
|
||||
crash> rd -u 0x00007f1cf6c37000
|
||||
|
||||
rd: invalid structure member offset: zram_compressor
|
||||
FILE: diskdump.c LINE: 2753 FUNCTION: try_zram_decompress()
|
||||
|
||||
[./crash] error trace: 47a7b1 => 5766eb => 5401b7 => 540146
|
||||
|
||||
540146: OFFSET_verify.part.0+70
|
||||
5401b7: OFFSET_verify+39
|
||||
5766eb: try_zram_decompress+635
|
||||
47a7b1: readmem+273
|
||||
|
||||
rd: invalid structure member offset: zram_compressor
|
||||
FILE: diskdump.c LINE: 2753 FUNCTION: try_zram_decompress()
|
||||
|
||||
Before zram support, trying to read memory that is swapped out
|
||||
resulted in inaccessible error as follows:
|
||||
|
||||
crash> rd -u 0x00007f1cf6c37000
|
||||
rd: invalid user virtual address: 7f1cf6c37000 type: "64-bit UVADDR"
|
||||
|
||||
This behavior is problematic for crash gcore command to support zram.
|
||||
The fault error terminates gcore command and then generating core file
|
||||
fails; this is regression. On the other hand, in the previous one,
|
||||
gcore command can continue by writing zero pages.
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
diskdump.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 8dda58643f6a..2b80e4a96ce4 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2753,8 +2753,11 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (INVALID_MEMBER(zram_compressor))
|
||||
+ if (INVALID_MEMBER(zram_compressor)) {
|
||||
zram_init();
|
||||
+ if (INVALID_MEMBER(zram_compressor))
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
if (CRASHDEBUG(2))
|
||||
error(WARNING, "this page has swapped to zram\n");
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,40 @@
|
||||
From 8a877e9146d24b21ded98fdc0cbbca9cced83e5d Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:47 +0900
|
||||
Subject: [PATCH 06/11] diskdump, zram: Notify necessity of loading zram module
|
||||
|
||||
By the previous commit, trying to read swapped-out-into-zram-disk
|
||||
pages results in inaccessible memory error that is apparently
|
||||
irrelevant to zram and users cannot find it necessary to load zram
|
||||
module. Thus, let's add a warning message to indicate that as follows:
|
||||
|
||||
crash> rd -u 0x7f520626e000
|
||||
WARNING: Some pages are swapped out to zram. Please run mod -s zram.
|
||||
rd: invalid user virtual address: 7f520626e000 type: "64-bit UVADDR"
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
diskdump.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 2b80e4a96ce4..30cb73fe2e19 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2755,8 +2755,12 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
|
||||
if (INVALID_MEMBER(zram_compressor)) {
|
||||
zram_init();
|
||||
- if (INVALID_MEMBER(zram_compressor))
|
||||
+ if (INVALID_MEMBER(zram_compressor)) {
|
||||
+ error(WARNING,
|
||||
+ "Some pages are swapped out to zram. "
|
||||
+ "Please run mod -s zram.\n");
|
||||
return 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (CRASHDEBUG(2))
|
||||
--
|
||||
2.29.2
|
||||
|
79
0026-zram-include-zram-code-even-without-lzo-library.patch
Normal file
79
0026-zram-include-zram-code-even-without-lzo-library.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From 2254dc4e5710b594bbc47e8b28c88f96fc2b246e Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:48 +0900
|
||||
Subject: [PATCH 07/11] zram: include zram code even without lzo library
|
||||
|
||||
Currently, zram code is included only when LZO is enabled. However,
|
||||
more natural implementation is that if users encounter pages swapped
|
||||
into zram that are compressed with unsupported compression algorithm,
|
||||
crash notifies that. To do so, let's include zram code by default.
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
defs.h | 2 --
|
||||
diskdump.c | 11 ++++-------
|
||||
2 files changed, 4 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 35b983abd403..ebd7bb615b61 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -6541,7 +6541,6 @@ void diskdump_device_dump_info(FILE *);
|
||||
void diskdump_device_dump_extract(int, char *, FILE *);
|
||||
/*support for zram*/
|
||||
ulong try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong vaddr);
|
||||
-#ifdef LZO
|
||||
#define OBJ_TAG_BITS 1
|
||||
#ifndef MAX_POSSIBLE_PHYSMEM_BITS
|
||||
#define MAX_POSSIBLE_PHYSMEM_BITS (MAX_PHYSMEM_BITS())
|
||||
@@ -6567,7 +6566,6 @@ struct zspage {
|
||||
unsigned int inuse;
|
||||
unsigned int freeobj;
|
||||
};
|
||||
-#endif
|
||||
|
||||
/*
|
||||
* makedumpfile.c
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 30cb73fe2e19..17094f126f25 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2591,7 +2591,6 @@ diskdump_device_dump_info(FILE *ofp)
|
||||
}
|
||||
}
|
||||
|
||||
-#ifdef LZO
|
||||
static void
|
||||
zram_init(void)
|
||||
{
|
||||
@@ -2772,6 +2771,7 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
readmem(zram + OFFSET(zram_compressor), KVADDR, name,
|
||||
sizeof(name), "zram compressor", FAULT_ON_ERROR);
|
||||
if (STREQ(name, "lzo")) {
|
||||
+#ifdef LZO
|
||||
if (!(dd->flags & LZO_SUPPORTED)) {
|
||||
if (lzo_init() == LZO_E_OK)
|
||||
dd->flags |= LZO_SUPPORTED;
|
||||
@@ -2779,6 +2779,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
return 0;
|
||||
}
|
||||
decompressor = (void *)lzo1x_decompress_safe;
|
||||
+#else
|
||||
+ return 0;
|
||||
+#endif
|
||||
} else { /* todo: support more compressor */
|
||||
error(WARNING, "only the lzo compressor is supported\n");
|
||||
return 0;
|
||||
@@ -2846,9 +2849,3 @@ out:
|
||||
FREEBUF(zram_buf);
|
||||
return len;
|
||||
}
|
||||
-#else
|
||||
-ulong try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong vaddr)
|
||||
-{
|
||||
- return 0;
|
||||
-}
|
||||
-#endif
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,37 @@
|
||||
From dc2cb5f9256ec2bc118cb34c610e2c62c20aab6e Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:49 +0900
|
||||
Subject: [PATCH 08/11] zram: Add warning message when crash is built without
|
||||
lzo library
|
||||
|
||||
Now there is no warning message when we encounter zram pages using
|
||||
crash utility that is built without lzo library. We need to provide
|
||||
any hint to users what is going on. Let's add a warning message to
|
||||
indicate the hint as:
|
||||
|
||||
crash> rd -u 0x7f520626e000
|
||||
WARNING: zram decompress error: this executable needs to be built with lzo library
|
||||
rd: invalid user virtual address: 7f520626e000 type: "64-bit UVADDR"
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
diskdump.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 17094f126f25..a4ca38f6c732 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2780,6 +2780,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
}
|
||||
decompressor = (void *)lzo1x_decompress_safe;
|
||||
#else
|
||||
+ error(WARNING,
|
||||
+ "zram decompress error: this executable needs to be built"
|
||||
+ " with lzo library\n");
|
||||
return 0;
|
||||
#endif
|
||||
} else { /* todo: support more compressor */
|
||||
--
|
||||
2.29.2
|
||||
|
154
0028-memory-zram-introduce-and-export-readswap.patch
Normal file
154
0028-memory-zram-introduce-and-export-readswap.patch
Normal file
@ -0,0 +1,154 @@
|
||||
From 74474a366d1244d344ad9ff222e8e2351a96af8c Mon Sep 17 00:00:00 2001
|
||||
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
Date: Fri, 25 Dec 2020 15:48:50 +0900
|
||||
Subject: [PATCH 09/11] memory, zram: introduce and export readswap()
|
||||
|
||||
try_zram_decompress() is currently exported to extension modules, but
|
||||
from a viewpoint of author of extension modules, it's better to export
|
||||
an interface to read memory on swap; difference of decompressor are
|
||||
then hidden within the interface and there is no need for extension
|
||||
modules to update accordingly each time new decompressor are added in
|
||||
the future.
|
||||
|
||||
So let's introduce function readswap() as an interface to read memory
|
||||
on swap.
|
||||
|
||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
||||
---
|
||||
defs.h | 1 +
|
||||
diskdump.c | 63 ++++++++++++++++++++++++++++++++++++++----------------
|
||||
memory.c | 2 +-
|
||||
3 files changed, 46 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index ebd7bb615b61..c29b3fa3dee9 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -6539,6 +6539,7 @@ int diskdump_get_nr_cpus(void);
|
||||
QEMUCPUState *diskdump_get_qemucpustate(int);
|
||||
void diskdump_device_dump_info(FILE *);
|
||||
void diskdump_device_dump_extract(int, char *, FILE *);
|
||||
+ulong readswap(ulonglong pte_val, char *buf, ulong len, ulonglong vaddr);
|
||||
/*support for zram*/
|
||||
ulong try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong vaddr);
|
||||
#define OBJ_TAG_BITS 1
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index a4ca38f6c732..03a77a977646 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -2709,24 +2709,13 @@ lookup_swap_cache(ulonglong pte_val, unsigned char *zram_buf)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-ulong (*decompressor)(unsigned char *in_addr, ulong in_size, unsigned char *out_addr, ulong *out_size, void *other/* NOT USED */);
|
||||
-/*
|
||||
- * If userspace address was swapped out to zram, this function is called to decompress the object.
|
||||
- * try_zram_decompress returns decompressed page data and data length
|
||||
- */
|
||||
-ulong
|
||||
-try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong vaddr)
|
||||
+static int get_disk_name_private_data(ulonglong pte_val, ulonglong vaddr,
|
||||
+ char *name, ulong *private_data)
|
||||
{
|
||||
- char name[32] = {0};
|
||||
- ulonglong swp_offset;
|
||||
- ulong swap_info, bdev, bd_disk, zram, zram_table_entry, sector, index, entry, flags, size, outsize, off;
|
||||
- unsigned char *obj_addr = NULL;
|
||||
- unsigned char *zram_buf = NULL;
|
||||
- unsigned char *outbuf = NULL;
|
||||
+ ulong swap_info, bdev, bd_disk;
|
||||
|
||||
- off = PAGEOFFSET(vaddr);
|
||||
if (!symbol_exists("swap_info"))
|
||||
- return 0;
|
||||
+ return FALSE;
|
||||
|
||||
swap_info = symbol_value("swap_info");
|
||||
|
||||
@@ -2743,14 +2732,49 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
sizeof(void *), "swap_info_struct_bdev", FAULT_ON_ERROR);
|
||||
readmem(bdev + OFFSET(block_device_bd_disk), KVADDR, &bd_disk,
|
||||
sizeof(void *), "block_device_bd_disk", FAULT_ON_ERROR);
|
||||
- readmem(bd_disk + OFFSET(gendisk_disk_name), KVADDR, name,
|
||||
+ if (name)
|
||||
+ readmem(bd_disk + OFFSET(gendisk_disk_name), KVADDR, name,
|
||||
strlen("zram"), "gendisk_disk_name", FAULT_ON_ERROR);
|
||||
+ if (private_data)
|
||||
+ readmem(bd_disk + OFFSET(gendisk_private_data), KVADDR,
|
||||
+ private_data, sizeof(void *), "gendisk_private_data",
|
||||
+ FAULT_ON_ERROR);
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+ulong readswap(ulonglong pte_val, char *buf, ulong len, ulonglong vaddr)
|
||||
+{
|
||||
+ char name[32] = {0};
|
||||
|
||||
- if (strncmp(name, "zram", strlen("zram"))) {
|
||||
+ if (!get_disk_name_private_data(pte_val, vaddr, name, NULL))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!strncmp(name, "zram", 4)) {
|
||||
+ return try_zram_decompress(pte_val, (unsigned char *)buf, len, vaddr);
|
||||
+ } else {
|
||||
if (CRASHDEBUG(2))
|
||||
error(WARNING, "this page has been swapped to %s\n", name);
|
||||
return 0;
|
||||
}
|
||||
+}
|
||||
+
|
||||
+ulong (*decompressor)(unsigned char *in_addr, ulong in_size, unsigned char *out_addr,
|
||||
+ ulong *out_size, void *other/* NOT USED */);
|
||||
+/*
|
||||
+ * If userspace address was swapped out to zram, this function is called to decompress the object.
|
||||
+ * try_zram_decompress returns decompressed page data and data length
|
||||
+ */
|
||||
+ulong
|
||||
+try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong vaddr)
|
||||
+{
|
||||
+ char name[32] = {0};
|
||||
+ ulonglong swp_offset;
|
||||
+ unsigned char *obj_addr = NULL;
|
||||
+ unsigned char *zram_buf = NULL;
|
||||
+ unsigned char *outbuf = NULL;
|
||||
+ ulong zram, zram_table_entry, sector, index, entry, flags, size,
|
||||
+ outsize, off;
|
||||
|
||||
if (INVALID_MEMBER(zram_compressor)) {
|
||||
zram_init();
|
||||
@@ -2765,8 +2789,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
if (CRASHDEBUG(2))
|
||||
error(WARNING, "this page has swapped to zram\n");
|
||||
|
||||
- readmem(bd_disk + OFFSET(gendisk_private_data), KVADDR, &zram,
|
||||
- sizeof(void *), "gendisk_private_data", FAULT_ON_ERROR);
|
||||
+ if (!get_disk_name_private_data(pte_val, vaddr, NULL, &zram))
|
||||
+ return 0;
|
||||
|
||||
readmem(zram + OFFSET(zram_compressor), KVADDR, name,
|
||||
sizeof(name), "zram compressor", FAULT_ON_ERROR);
|
||||
@@ -2798,6 +2822,7 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
|
||||
|
||||
zram_buf = (unsigned char *)GETBUF(PAGESIZE());
|
||||
/* lookup page from swap cache */
|
||||
+ off = PAGEOFFSET(vaddr);
|
||||
obj_addr = lookup_swap_cache(pte_val, zram_buf);
|
||||
if (obj_addr != NULL) {
|
||||
memcpy(buf, obj_addr + off, len);
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 33b0ca7af977..17ac40b3e0f9 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -2294,7 +2294,7 @@ readmem(ulonglong addr, int memtype, void *buffer, long size,
|
||||
if (cnt > size)
|
||||
cnt = size;
|
||||
|
||||
- cnt = try_zram_decompress(paddr, (unsigned char *)bufptr, cnt, addr);
|
||||
+ cnt = readswap(paddr, bufptr, cnt, addr);
|
||||
if (cnt) {
|
||||
bufptr += cnt;
|
||||
addr += cnt;
|
||||
--
|
||||
2.29.2
|
||||
|
78
0029-GDB-fix-the-failure-of-set-scope-command.patch
Normal file
78
0029-GDB-fix-the-failure-of-set-scope-command.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From 697485337184d0f5ed8cdb3ca6d2dae38ec62fd7 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 22 Mar 2021 16:30:32 +0800
|
||||
Subject: [PATCH 10/11] GDB: fix the failure of 'set scope' command
|
||||
|
||||
Currently some commands such as 'sys' may cause subsequent 'set scope'
|
||||
commands to fail because it may not find the correct symtab associated
|
||||
with PC and SECTION in the find_pc_sect_symtab(), eventually, this will
|
||||
cause the following failure:
|
||||
|
||||
crash> mod -S 3.10.0-957.el7.x86_64
|
||||
crash> mod -d dm_service_time
|
||||
crash> mod -sr dm_service_time
|
||||
crash> set scope st_create
|
||||
scope: ffffffffc044d270 (st_create)
|
||||
crash> sys
|
||||
KERNEL: 3.10.0-957.el7.x86_64/vmlinux
|
||||
DUMPFILE: crash/vmcore [PARTIAL DUMP]
|
||||
...
|
||||
crash> set scope st_create
|
||||
set: gdb cannot find text block for address: st_create
|
||||
|
||||
To find the correct symtab, let's check whether there is an address
|
||||
mapping to 'block' in the symtab searching loop and the PC is in the
|
||||
range. If the symtab associated with PC is found, and then use it.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
gdb-7.6.patch | 36 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
|
||||
diff --git a/gdb-7.6.patch b/gdb-7.6.patch
|
||||
index f64b55fe547a..2c3ab57375c8 100644
|
||||
--- a/gdb-7.6.patch
|
||||
+++ b/gdb-7.6.patch
|
||||
@@ -2501,3 +2501,39 @@ diff -up gdb-7.6/opcodes/configure.orig gdb-7.6/opcodes/configure
|
||||
#include "features/aarch64.c"
|
||||
#include "features/aarch64-without-fpu.c"
|
||||
|
||||
+--- gdb-7.6/gdb/symtab.c.orig
|
||||
++++ gdb-7.6/gdb/symtab.c
|
||||
+@@ -2080,7 +2080,7 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
|
||||
+ struct symtab *s = NULL;
|
||||
+ struct symtab *best_s = NULL;
|
||||
+ struct objfile *objfile;
|
||||
+- CORE_ADDR distance = 0;
|
||||
++ CORE_ADDR distance = 0, start, end;
|
||||
+ struct minimal_symbol *msymbol;
|
||||
+
|
||||
+ /* If we know that this is not a text address, return failure. This is
|
||||
+@@ -2117,10 +2117,20 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
|
||||
+ bv = BLOCKVECTOR (s);
|
||||
+ b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
||||
+
|
||||
+- if (BLOCK_START (b) <= pc
|
||||
+- && BLOCK_END (b) > pc
|
||||
+- && (distance == 0
|
||||
+- || BLOCK_END (b) - BLOCK_START (b) < distance))
|
||||
++ start = BLOCK_START (b);
|
||||
++ end = BLOCK_END (b);
|
||||
++
|
||||
++ /*
|
||||
++ * If we have an addrmap mapping code addresses to blocks, and pc
|
||||
++ * is in the range [start, end), let's use it.
|
||||
++ */
|
||||
++ if ((pc >= start && pc < end) && BLOCKVECTOR_MAP (bv)) {
|
||||
++ if (addrmap_find (BLOCKVECTOR_MAP (bv), pc))
|
||||
++ return s;
|
||||
++ }
|
||||
++
|
||||
++ if ((pc >= start && pc < end) && ((distance == 0)
|
||||
++ || (end - start < distance)))
|
||||
+ {
|
||||
+ /* For an objfile that has its functions reordered,
|
||||
+ find_pc_psymtab will find the proper partial symbol table
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 8dfc228b29aebba2a9bc59944490aae697f79461 Mon Sep 17 00:00:00 2001
|
||||
From: John Pittman <jpittman@redhat.com>
|
||||
Date: Fri, 26 Mar 2021 12:56:15 -0400
|
||||
Subject: [PATCH 11/11] symbols: fix offset print for function pointers that
|
||||
return pointers
|
||||
|
||||
In the show_member_offset() function, when trying to handle function
|
||||
pointers, the case for "(*" is handled. However, if the function
|
||||
pointer returns a pointer or a pointer to a pointer, then the
|
||||
condition is unhandled. This results in the offset not being printed,
|
||||
for example:
|
||||
|
||||
crash> struct -o offload_callbacks
|
||||
struct offload_callbacks {
|
||||
struct sk_buff *(*gso_segment)(struct sk_buff *, netdev_features_t);
|
||||
struct sk_buff **(*gro_receive)(struct sk_buff **, struct sk_buff *);
|
||||
[16] int (*gro_complete)(struct sk_buff *, int);
|
||||
}
|
||||
|
||||
Fix by first checking if the member is potentially a function pointer,
|
||||
then checking if it returns a pointer or a pointer to a pointer.
|
||||
|
||||
[ kh: added the example output above ]
|
||||
|
||||
Signed-off-by: John Pittman <jpittman@redhat.com>
|
||||
---
|
||||
symbols.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index a2d5c6c6178f..5d7da6e954bc 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -8356,8 +8356,15 @@ show_member_offset(FILE *ofp, struct datatype_member *dm, char *inbuf)
|
||||
}
|
||||
} else if (c) {
|
||||
for (i = 0; i < c; i++) {
|
||||
- if (STRNEQ(arglist[i], "(*")) {
|
||||
- target = arglist[i]+2;
|
||||
+ if (strstr(inbuf, "(*")) {
|
||||
+ if (STRNEQ(arglist[i], "(*"))
|
||||
+ target = arglist[i]+2;
|
||||
+ else if (STRNEQ(arglist[i], "*(*"))
|
||||
+ target = arglist[i]+3;
|
||||
+ else if (STRNEQ(arglist[i], "**(*"))
|
||||
+ target = arglist[i]+4;
|
||||
+ else
|
||||
+ continue;
|
||||
if (!(t1 = strstr(target, ")")))
|
||||
continue;
|
||||
*t1 = NULLCHAR;
|
||||
--
|
||||
2.29.2
|
||||
|
27
crash.spec
27
crash.spec
@ -4,7 +4,7 @@
|
||||
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
|
||||
Name: crash
|
||||
Version: 7.2.9
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv3
|
||||
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
|
||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
|
||||
@ -39,6 +39,17 @@ Patch18: 0016-x86_64-fix-bt-command-on-5.12-rc1-and-later-kernels.patch
|
||||
Patch19: 0017-Add-valgrind-support-for-the-crash-s-custom-memory-a.patch
|
||||
Patch20: 0018-symbols-Fix-potential-read-to-already-freed-object.patch
|
||||
Patch21: 0019-tools-Fix-potential-write-to-object-of-0-size.patch
|
||||
Patch22: 0020-struct-fix-struct-print-member-array-of-list_heads.patch
|
||||
Patch23: 0021-Do-not-pass-through-the-sy-command-to-GDB.patch
|
||||
Patch24: 0022-diskdump-zram-cleanup-try_zram_decompress.patch
|
||||
Patch25: 0023-diskdump-zram-initialize-zram-symbol-information-whe.patch
|
||||
Patch26: 0024-diskdump-zram-fix-fault-error-when-reading-zram-disk.patch
|
||||
Patch27: 0025-diskdump-zram-Notify-necessity-of-loading-zram-modul.patch
|
||||
Patch28: 0026-zram-include-zram-code-even-without-lzo-library.patch
|
||||
Patch29: 0027-zram-Add-warning-message-when-crash-is-built-without.patch
|
||||
Patch30: 0028-memory-zram-introduce-and-export-readswap.patch
|
||||
Patch31: 0029-GDB-fix-the-failure-of-set-scope-command.patch
|
||||
Patch32: 0030-symbols-fix-offset-print-for-function-pointers-that-.patch
|
||||
|
||||
%description
|
||||
The core analysis suite is a self-contained tool that can be used to
|
||||
@ -80,6 +91,17 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
|
||||
%build
|
||||
# This package has an internal copy of GDB which has broken configure code for
|
||||
@ -111,6 +133,9 @@ cp -p defs.h %{buildroot}%{_includedir}/crash
|
||||
%{_includedir}/*
|
||||
|
||||
%changelog
|
||||
* Tue Apr 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-6
|
||||
- Update to the latest upstream: commit <8dfc228b29ae>
|
||||
|
||||
* Mon Mar 08 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-5
|
||||
- Fix Segmentation fault
|
||||
- Update to the latest upstream: commit <9c0c6c1b3750>
|
||||
|
Loading…
Reference in New Issue
Block a user