[packages/kmod] don't use in-kernel xz module decompression with kernels < 6.6
atler
atler at pld-linux.org
Fri May 2 20:58:39 CEST 2025
commit 1942c4020a1b9043bdf8e70b7352fbfbdef57c9b
Author: Jan Palus <atler at pld-linux.org>
Date: Fri May 2 20:24:27 2025 +0200
don't use in-kernel xz module decompression with kernels < 6.6
kmod >= 31 passes compressed module to kernel if in-kernel module
decompression is supported. kernel's "xz embedded" decompressor supports
crc32 checksum algorithm but not xz's default crc64:
https://www.kernel.org/doc/html/v6.14/staging/xz.html
until kernel 6.6 modules were installed with crc64 therefore
incompatible with itself. following commit fixes the issue starting with
kernel 6.6:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fbf5892df21a8ccfcb2fda0fd65bc3169c89ed28
resolve the issue by checking kernel version first and avoid using
in-kernel xz decompressor if it's lower than 6.6
kmod.spec | 2 ++
xz-in-kernel-decompr-compat.patch | 45 +++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
---
diff --git a/kmod.spec b/kmod.spec
index 5fc7e00..5c6336e 100644
--- a/kmod.spec
+++ b/kmod.spec
@@ -23,6 +23,7 @@ Source1: %{name}-blacklist
Source2: %{name}-usb
Patch0: %{name}-modprobe.d-kver.patch
Patch1: %{name}-depmod.d-kver.patch
+Patch2: xz-in-kernel-decompr-compat.patch
URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
BuildRequires: autoconf >= 2.64
BuildRequires: automake >= 1:1.11
@@ -123,6 +124,7 @@ Bashowe uzupełnianie nazw dla narzędzi kmod.
%setup -q
%patch -P 0 -p1
%patch -P 1 -p1
+%patch -P 2 -p1
%build
%{__libtoolize}
diff --git a/xz-in-kernel-decompr-compat.patch b/xz-in-kernel-decompr-compat.patch
new file mode 100644
index 0000000..d37318c
--- /dev/null
+++ b/xz-in-kernel-decompr-compat.patch
@@ -0,0 +1,45 @@
+--- kmod-34.2/libkmod/libkmod.c.orig 2025-05-02 14:53:30.252042909 +0200
++++ kmod-34.2/libkmod/libkmod.c 2025-05-02 20:20:41.040692282 +0200
+@@ -206,9 +206,39 @@
+
+ if (streq(buf, "zstd\n"))
+ return KMOD_FILE_COMPRESSION_ZSTD;
+- else if (streq(buf, "xz\n"))
+- return KMOD_FILE_COMPRESSION_XZ;
+- else if (streq(buf, "gzip\n"))
++ else if (streq(buf, "xz\n")) {
++ struct utsname u;
++ long major, minor;
++ char *num, *endptr;
++
++ if (uname(&u) < 0)
++ return KMOD_FILE_COMPRESSION_NONE;
++
++ num = strtok(u.release, ".");
++
++ if (num == NULL)
++ return KMOD_FILE_COMPRESSION_NONE;
++
++ major = strtol(num, &endptr, 10);
++
++ if (*endptr != '\0')
++ return KMOD_FILE_COMPRESSION_NONE;
++
++ num = strtok(NULL, ".");
++
++ if (num == NULL)
++ return KMOD_FILE_COMPRESSION_NONE;
++
++ minor = strtol(num, &endptr, 10);
++
++ if (*endptr != '\0')
++ return KMOD_FILE_COMPRESSION_NONE;
++
++ if (major > 6L || (major == 6L && minor >= 6L))
++ return KMOD_FILE_COMPRESSION_XZ;
++ else
++ return KMOD_FILE_COMPRESSION_NONE;
++ } else if (streq(buf, "gzip\n"))
+ return KMOD_FILE_COMPRESSION_ZLIB;
+
+ ERR(ctx, "unknown kernel compression %s", buf);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/kmod.git/commitdiff/1942c4020a1b9043bdf8e70b7352fbfbdef57c9b
More information about the pld-cvs-commit
mailing list