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(a)fujitsu.com>
---
diskdump.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/diskdump.c b/diskdump.c
index 047d8ad..304e9a1 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2749,8 +2749,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");
--
1.8.3.1