On 2024/03/28 17:15, Yulong TANG 汤玉龙 wrote:
 In Linux 5.1, the ZRAM block driver has changed its default
compressor 
 from "lzo" to "lzo-rle" to enhance LZO compression support. However,
 crash does not support the improved LZO algorithm, resulting in failure 
 when reading memory.
 
       change default compressor : ce82f19fd5809f0cf87ea9f753c5cc65ca0673d6
 
 The issue was discovered when using the extension 'gcore' to generate a 
 process coredump, which was found to be incomplete and unable to be 
 opened properly with gdb.
 This patch is for Crash-utility tool, it enables the Crash-utility to 
 support decompression of the "lzo-rle" compression algorithm used in 
 zram. The patch has been tested with vmcore files from kernel version 
 5.4, and successfully allows reading of memory compressed with the zram 
 compression algorithm.
 
 Testing:
 ========
 
 before apply this patch :
       crash> gcore -v 0 1
       gcore: WARNING: only the lzo compressor is supported
       gcore: WARNING: only the lzo compressor is supported
       gcore: WARNING: only the lzo compressor is supported
 after:
       crash> gcore -v 0
       1 Saved core.1.init
 
 Changelog:
 ==========
 v2: keep the "if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)" 
 related code of the copied kernel code, but change the "if defined" 
 macro into a runtime check .
 v3: set a default value of HAVE_EFFICIENT_UNALIGNED_ACCESS depending on 
 architecture, for no ikconfig kernels.
 v4: avoid checking CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS every 
 call;move "include lzorle_decompress.h" to diskdump.c from def.h
 
thank you for the update.
The patch tested OK with lzo-rle zram, but I found a small issue and 
redundant codes, and fixed them.  Could you check the attached patch again?
* "make ctags" didn't work for lzorle_decompress.h, so added it to 
SOURCE_FILES.
* There was no need to include stdint.h and string.h in 
lzorle_decompress.c, so removed them.
* There are the same code blocks in "if (efficient_unligned_access)" 
block and else block.  Isn't this ok?
     if (efficient_unaligned_access &&
         (HAVE_IP(t + 15) && HAVE_OP(t + 15))) {
* Why are NEED_IP() and etc. new-lined?  Replaced them with one lines 
like the original kernel code.
     #define NEED_IP(x)      if (!HAVE_IP(x)) goto input_overrun
     #define NEED_OP(x)      if (!HAVE_OP(x)) goto output_overrun
     #define TEST_LB(m_pos)  if ((m_pos) < out) goto lookbehind_overrun
Thanks,
Kazu
 
 Patch:
 ==========
 
 See attachment.
 
 
 
 Thanks and regards,
 Yulong
 
 
 --
 Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
 To unsubscribe send an email to devel-leave(a)lists.crash-utility.osci.io
 https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
 Contribution Guidelines: 
https://github.com/crash-utility/crash/wiki