Re: [PATCH] libdwfl: Add ZSTD support.

2020-09-21 Thread Mark Wielaard
Hi,

On Fri, 2020-09-18 at 15:17 +0200, Mark Wielaard wrote:
> Newer kernels might be compressed using ZSTD add support to libdwfl
> open so we can can automatically read ZSTD compressed files and
> kernel images.
> 
> The support is very similar to the bzip2 and lzma support, but
> slightly different. With a bit more macros it could maybe have used
> the gzip.c USE_INFLATE code path. But I felt that the many macros
> didn't really help understand the code. So the unzip routine has a
> slightly different code path for ZSTD.

This seems to work as intended. I pushed it with one small tweak we
discussed on irc:

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 253ae069..344db7c1 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -8,6 +8,7 @@
(unzip): Change pread_retry failure from zlib_fail to fail.
Add ZSTD support.
* open.c (decompress): Also try __libdw_unzstd.
+   * linux-kernel-modules.c (check_suffix): Also TRY ".ko.zst".
 
 2020-08-20  Dmitry V. Levin  
 
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 548cb56f..6edb27f2 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -357,6 +357,9 @@ check_suffix (const FTSENT *f, size_t namelen)
 #if USE_LZMA
   TRY (".ko.xz");
 #endif
+#if USE_ZSTD
+  TRY (".ko.zst");
+#endif
 
   return 0;
 
This makes sure that once kernel modules are also zstd compressed we'll
pick them up automagically (they currently aren't but the check is a
simple memcmp and the extension is standard).

Cheers,

Mark


[Bug general/26632] eu-readelf doesn't grok /boot/vmlinuz-5.9.0* from fedora rawhide (.fc34) which is ZSTD compressed

2020-09-21 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=26632

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #3 from Mark Wielaard  ---
commit 52536d7d213846a3122d4dd40f6268f231109990
Author: Mark Wielaard 
Date:   Fri Sep 18 12:49:29 2020 +0200

libdwfl: Add ZSTD support.

Newer kernels might be compressed using ZSTD add support to libdwfl open
so we can can automatically read ZSTD compressed files and kernel images.

The support is very similar to the bzip2 and lzma support, but slightly
different. With a bit more macros it could maybe have used the gzip.c
USE_INFLATE code path. But I felt that the many macros didn't really help
understand the code. So the unzip routine has a slightly different code
path for ZSTD.

https://sourceware.org/bugzilla/show_bug.cgi?id=26632

Signed-off-by: Mark Wielaard 

-- 
You are receiving this mail because:
You are on the CC list for the bug.