123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- diff -urdN kmod-29.orig/Makefile.am kmod-29/Makefile.am
- --- kmod-29.orig/Makefile.am 2021-05-21 00:37:20.553782500 +0200
- +++ kmod-29/Makefile.am 2022-02-27 13:55:12.910447392 +0100
- @@ -19,7 +19,7 @@
- -include $(top_builddir)/config.h \
- -I$(top_srcdir) \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- - ${zlib_CFLAGS}
- + ${lzlib_CFLAGS} ${zlib_CFLAGS}
-
- AM_CFLAGS = $(OUR_CFLAGS)
- AM_LDFLAGS = $(OUR_LDFLAGS)
- @@ -35,6 +35,8 @@
- -e 's,@libzstd_LIBS\@,${libzstd_LIBS},g' \
- -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
- -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
- + -e 's,@lzlib_CFLAGS\@,${lzlib_CFLAGS},g' \
- + -e 's,@lzlib_LIBS\@,${lzlib_LIBS},g' \
- -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
- -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
- -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
- @@ -105,7 +107,7 @@
- ${top_srcdir}/libkmod/libkmod.sym
- libkmod_libkmod_la_LIBADD = \
- shared/libshared.la \
- - ${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
- + ${libzstd_LIBS} ${liblzma_LIBS} ${lzlib_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
-
- noinst_LTLIBRARIES += libkmod/libkmod-internal.la
- libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
- diff -urdN kmod-29.orig/Makefile.in kmod-29/Makefile.in
- --- kmod-29.orig/Makefile.in 2021-05-21 01:02:52.645592794 +0200
- +++ kmod-29/Makefile.in 2022-02-27 13:55:12.920445685 +0100
- @@ -910,6 +910,8 @@
- libzstd_LIBS = @libzstd_LIBS@
- localedir = @localedir@
- localstatedir = @localstatedir@
- +lzlib_CFLAGS = @lzlib_CFLAGS@
- +lzlib_LIBS = @lzlib_LIBS@
- mandir = @mandir@
- mkdir_p = @mkdir_p@
- oldincludedir = @oldincludedir@
- @@ -981,7 +983,7 @@
- -include $(top_builddir)/config.h \
- -I$(top_srcdir) \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- - ${zlib_CFLAGS}
- + ${lzlib_CFLAGS} ${zlib_CFLAGS}
-
- AM_CFLAGS = $(OUR_CFLAGS)
- AM_LDFLAGS = $(OUR_LDFLAGS)
- @@ -996,6 +998,8 @@
- -e 's,@libzstd_LIBS\@,${libzstd_LIBS},g' \
- -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
- -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
- + -e 's,@lzlib_CFLAGS\@,${lzlib_CFLAGS},g' \
- + -e 's,@lzlib_LIBS\@,${lzlib_LIBS},g' \
- -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
- -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
- -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
- @@ -1060,7 +1064,7 @@
-
- libkmod_libkmod_la_LIBADD = \
- shared/libshared.la \
- - ${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
- + ${libzstd_LIBS} ${liblzma_LIBS} ${lzlib_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
-
- libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
- libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
- diff -urdN kmod-29.orig/README kmod-29/README
- --- kmod-29.orig/README 2021-01-21 03:49:19.913366600 +0100
- +++ kmod-29/README 2022-02-27 13:55:12.920445685 +0100
- @@ -47,6 +47,7 @@
-
- Optional dependencies:
- - ZLIB library
- + - LZLIB library
- - LZMA library
-
- Typical configuration:
- diff -urdN kmod-29.orig/config.h.in kmod-29/config.h.in
- --- kmod-29.orig/config.h.in 2021-05-21 01:03:51.174335845 +0200
- +++ kmod-29/config.h.in 2022-02-27 13:55:12.920445685 +0100
- @@ -15,6 +15,9 @@
- /* Enable Xz for modules. */
- #undef ENABLE_XZ
-
- +/* Enable lzlib for modules. */
- +#undef ENABLE_LZLIB
- +
- /* Enable zlib for modules. */
- #undef ENABLE_ZLIB
-
- diff -urdN kmod-29.orig/configure.ac kmod-29/configure.ac
- --- kmod-29.orig/configure.ac 2021-05-21 00:37:39.438647859 +0200
- +++ kmod-29/configure.ac 2022-02-27 13:55:12.920445685 +0100
- @@ -105,6 +105,17 @@
- ])
- CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
-
- +AC_ARG_WITH([lzlib],
- + AS_HELP_STRING([--with-lzlib], [handle lzipped modules @<:@default=disabled@:>@]),
- + [], [with_lzlib=no])
- +AS_IF([test "x$with_lzlib" != "xno"], [
- + PKG_CHECK_MODULES([lzlib], [lzlib])
- + AC_DEFINE([ENABLE_LZLIB], [1], [Enable lzlib for modules.])
- +], [
- + AC_MSG_NOTICE([lzlib support not requested])
- +])
- +CC_FEATURE_APPEND([with_features], [with_lzlib], [LZLIB])
- +
- AC_ARG_WITH([zlib],
- AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
- [], [with_zlib=no])
- @@ -320,7 +331,7 @@
- tools: ${enable_tools}
- python bindings: ${enable_python}
- logging: ${enable_logging}
- - compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib}
- + compression: zstd=${with_zstd} xz=${with_xz} lzlib=${with_lzlib} zlib=${with_zlib}
- debug: ${enable_debug}
- coverage: ${enable_coverage}
- doc: ${enable_gtk_doc}
- diff -urdN kmod-29.orig/configure kmod-29/configure
- --- kmod-29.orig/configure 2021-05-21 01:02:52.949057874 +0200
- +++ kmod-29/configure 2022-02-27 19:34:02.380431023 +0100
- @@ -701,6 +701,8 @@
- libcrypto_CFLAGS
- zlib_LIBS
- zlib_CFLAGS
- +lzlib_LIBS
- +lzlib_CFLAGS
- liblzma_LIBS
- liblzma_CFLAGS
- libzstd_LIBS
- @@ -845,6 +847,7 @@
- with_rootlibdir
- with_zstd
- with_xz
- +with_lzlib
- with_zlib
- with_openssl
- with_bashcompletiondir
- @@ -873,6 +876,8 @@
- libzstd_LIBS
- liblzma_CFLAGS
- liblzma_LIBS
- +lzlib_CFLAGS
- +lzlib_LIBS
- zlib_CFLAGS
- zlib_LIBS
- libcrypto_CFLAGS
- @@ -1550,6 +1555,7 @@
- --with-zstd handle Zstandard-compressed modules
- [default=disabled]
- --with-xz handle Xz-compressed modules [default=disabled]
- + --with-lzlib handle lzipped modules [default=disabled]
- --with-zlib handle gzipped modules [default=disabled]
- --with-openssl handle PKCS7 signatures [default=disabled]
- --with-bashcompletiondir=DIR
- @@ -1578,6 +1584,9 @@
- C compiler flags for liblzma, overriding pkg-config
- liblzma_LIBS
- linker flags for liblzma, overriding pkg-config
- + lzlib_CFLAGS
- + C compiler flags for lzlib, overriding pkg-config
- + lzlib_LIBS linker flags for lzlib, overriding pkg-config
- zlib_CFLAGS C compiler flags for zlib, overriding pkg-config
- zlib_LIBS linker flags for zlib, overriding pkg-config
- libcrypto_CFLAGS
- @@ -14174,6 +14183,146 @@
-
-
-
- +# Check whether --with-lzlib was given.
- +if test ${with_lzlib+y}
- +then :
- + withval=$with_lzlib;
- +else $as_nop
- + with_lzlib=no
- +fi
- +
- +if test "x$with_lzlib" != "xno"
- +then :
- +
- +
- +pkg_failed=no
- +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lzlib" >&5
- +printf %s "checking for lzlib... " >&6; }
- +
- +if test -n "$lzlib_CFLAGS"; then
- + pkg_cv_lzlib_CFLAGS="$lzlib_CFLAGS"
- + elif test -n "$PKG_CONFIG"; then
- + if test -n "$PKG_CONFIG" && \
- + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lzlib\""; } >&5
- + ($PKG_CONFIG --exists --print-errors "lzlib") 2>&5
- + ac_status=$?
- + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- + test $ac_status = 0; }; then
- + pkg_cv_lzlib_CFLAGS=`$PKG_CONFIG --cflags "lzlib" 2>/dev/null`
- + test "x$?" != "x0" && pkg_failed=yes
- +else
- + pkg_failed=yes
- +fi
- + else
- + pkg_failed=untried
- +fi
- +if test -n "$lzlib_LIBS"; then
- + pkg_cv_lzlib_LIBS="$lzlib_LIBS"
- + elif test -n "$PKG_CONFIG"; then
- + if test -n "$PKG_CONFIG" && \
- + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lzlib\""; } >&5
- + ($PKG_CONFIG --exists --print-errors "lzlib") 2>&5
- + ac_status=$?
- + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- + test $ac_status = 0; }; then
- + pkg_cv_lzlib_LIBS=`$PKG_CONFIG --libs "lzlib" 2>/dev/null`
- + test "x$?" != "x0" && pkg_failed=yes
- +else
- + pkg_failed=yes
- +fi
- + else
- + pkg_failed=untried
- +fi
- +
- +
- +
- +if test $pkg_failed = yes; then
- + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
- +printf "%s\n" "no" >&6; }
- +
- +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- + _pkg_short_errors_supported=yes
- +else
- + _pkg_short_errors_supported=no
- +fi
- + if test $_pkg_short_errors_supported = yes; then
- + lzlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lzlib" 2>&1`
- + else
- + lzlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lzlib" 2>&1`
- + fi
- + # Put the nasty error message in config.log where it belongs
- + echo "$lzlib_PKG_ERRORS" >&5
- +
- + as_fn_error $? "Package requirements (lzlib) were not met:
- +
- +$lzlib_PKG_ERRORS
- +
- +Consider adjusting the PKG_CONFIG_PATH environment variable if you
- +installed software in a non-standard prefix.
- +
- +Alternatively, you may set the environment variables lzlib_CFLAGS
- +and lzlib_LIBS to avoid the need to call pkg-config.
- +See the pkg-config man page for more details." "$LINENO" 5
- +elif test $pkg_failed = untried; then
- + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
- +printf "%s\n" "no" >&6; }
- + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
- +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
- +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
- +is in your PATH or set the PKG_CONFIG environment variable to the full
- +path to pkg-config.
- +
- +Alternatively, you may set the environment variables lzlib_CFLAGS
- +and lzlib_LIBS to avoid the need to call pkg-config.
- +See the pkg-config man page for more details.
- +
- +To get pkg-config, see <http://pkg-config.freedesktop.org/>.
- +See \`config.log' for more details" "$LINENO" 5; }
- +else
- + lzlib_CFLAGS=$pkg_cv_lzlib_CFLAGS
- + lzlib_LIBS=$pkg_cv_lzlib_LIBS
- + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
- +printf "%s\n" "yes" >&6; }
- +
- +fi
- +
- +printf "%s\n" "#define ENABLE_LZLIB 1" >>confdefs.h
- +
- +
- +else $as_nop
- +
- + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: lzlib support not requested" >&5
- +printf "%s\n" "$as_me: lzlib support not requested" >&6;}
- +
- +fi
- +
- +
- + case " $with_features " in #(
- + *" LZLIB "*) :
- + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : with_features already contains LZLIB"; } >&5
- + (: with_features already contains LZLIB) 2>&5
- + ac_status=$?
- + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- + test $ac_status = 0; } ;; #(
- + *) :
- +
- + if test "x$with_features" != "x"
- +then :
- + as_fn_append with_features " "
- +fi
- + if test "x$with_lzlib" = "xyes"
- +then :
- + as_fn_append with_features "+LZLIB"
- +else $as_nop
- + as_fn_append with_features "-LZLIB"
- +fi
- +
- + ;;
- +esac
- +
- +
- +
- +
- # Check whether --with-zlib was given.
- if test ${with_zlib+y}
- then :
- @@ -17743,7 +17892,7 @@
- tools: ${enable_tools}
- python bindings: ${enable_python}
- logging: ${enable_logging}
- - compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib}
- + compression: zstd=${with_zstd} xz=${with_xz} lzlib=${with_lzlib} zlib=${with_zlib}
- debug: ${enable_debug}
- coverage: ${enable_coverage}
- doc: ${enable_gtk_doc}
- @@ -17772,7 +17921,7 @@
- tools: ${enable_tools}
- python bindings: ${enable_python}
- logging: ${enable_logging}
- - compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib}
- + compression: zstd=${with_zstd} xz=${with_xz} lzlib=${with_lzlib} zlib=${with_zlib}
- debug: ${enable_debug}
- coverage: ${enable_coverage}
- doc: ${enable_gtk_doc}
- diff -urdN kmod-29.orig/libkmod/docs/Makefile.in kmod-29/libkmod/docs/Makefile.in
- --- kmod-29.orig/libkmod/docs/Makefile.in 2021-05-21 01:02:52.655597137 +0200
- +++ kmod-29/libkmod/docs/Makefile.in 2022-02-27 13:55:12.920445685 +0100
- @@ -248,6 +248,8 @@
- libzstd_LIBS = @libzstd_LIBS@
- localedir = @localedir@
- localstatedir = @localstatedir@
- +lzlib_CFLAGS = @lzlib_CFLAGS@
- +lzlib_LIBS = @lzlib_LIBS@
- mandir = @mandir@
- mkdir_p = @mkdir_p@
- oldincludedir = @oldincludedir@
- diff -urdN kmod-29.orig/libkmod/libkmod-file.c kmod-29/libkmod/libkmod-file.c
- --- kmod-29.orig/libkmod/libkmod-file.c 2020-09-11 06:55:01.331987063 +0200
- +++ kmod-29/libkmod/libkmod-file.c 2022-02-27 13:55:12.920445685 +0100
- @@ -37,6 +37,9 @@
- #endif
-
- #include <shared/util.h>
- +#ifdef ENABLE_LZLIB
- +#include <lzlib.h>
- +#endif
-
- #include "libkmod.h"
- #include "libkmod-internal.h"
- @@ -54,6 +57,9 @@
- #ifdef ENABLE_XZ
- bool xz_used;
- #endif
- +#ifdef ENABLE_LZLIB
- + bool lz_used;
- +#endif
- #ifdef ENABLE_ZLIB
- gzFile gzf;
- #endif
- @@ -310,6 +316,88 @@
- static const char magic_xz[] = {0xfd, '7', 'z', 'X', 'Z', 0};
- #endif
-
- +#ifdef ENABLE_LZLIB
- +#ifndef min
- + #define min(x,y) ((x) <= (y) ? (x) : (y))
- +#endif
- +
- +static int load_lzlib(struct kmod_file *file)
- +{
- + uint8_t in_buf[16384];
- + int err = 0;
- + off_t did = 0, total = 0;
- + _cleanup_free_ unsigned char *p = NULL;
- +
- + struct LZ_Decoder *lzd = LZ_decompress_open();
- + if (!lzd || LZ_decompress_errno( lzd ) != LZ_ok)
- + { LZ_decompress_close(lzd); return -ENOMEM; }
- +
- + for (;;) {
- + int rd;
- + const int size = min(LZ_decompress_write_size(lzd),
- + (int)sizeof in_buf);
- +
- + if (did == total) {
- + const int realloc_step = 4 * 1024 * 1024;
- + void *tmp = realloc(p, total + realloc_step);
- + if (tmp == NULL) {
- + err = -ENOMEM;
- + goto error;
- + }
- + total += realloc_step;
- + p = tmp;
- + }
- +
- + if (size > 0) {
- + rd = read(file->fd, in_buf, size);
- + if (rd < 0) {
- + err = -errno;
- + goto error;
- + }
- + if (rd == 0)
- + LZ_decompress_finish(lzd);
- + else if (LZ_decompress_write(lzd, in_buf, rd) != rd) {
- + err = -EINVAL;
- + goto error;
- + }
- + }
- + rd = LZ_decompress_read(lzd, p + did, total - did);
- + if (rd < 0) {
- + const char *lz_errmsg =
- + LZ_strerror(LZ_decompress_errno(lzd));
- +
- + ERR(file->ctx, "lzip: %s\n", lz_errmsg);
- + err = -EINVAL;
- + goto error;
- + }
- + did += rd;
- + if (LZ_decompress_finished(lzd) == 1)
- + break;
- + }
- +
- + if (LZ_decompress_close(lzd) < 0)
- + return -EINVAL;
- + file->lz_used = true;
- + file->memory = p;
- + file->size = did;
- + p = NULL;
- + return 0;
- +
- +error:
- + LZ_decompress_close(lzd);
- + return err;
- +}
- +
- +static void unload_lzlib(struct kmod_file *file)
- +{
- + if (!file->lz_used)
- + return;
- + free(file->memory);
- +}
- +
- +static const char magic_lzlib[] = { 0x4C, 0x5A, 0x49, 0x50 }; /* "LZIP" */
- +#endif
- +
- #ifdef ENABLE_ZLIB
- #define READ_STEP (4 * 1024 * 1024)
- static int load_zlib(struct kmod_file *file)
- @@ -385,6 +473,9 @@
- #ifdef ENABLE_XZ
- {sizeof(magic_xz), magic_xz, {load_xz, unload_xz}},
- #endif
- +#ifdef ENABLE_LZLIB
- + {sizeof(magic_lzlib), magic_lzlib, {load_lzlib, unload_lzlib}},
- +#endif
- #ifdef ENABLE_ZLIB
- {sizeof(magic_zlib), magic_zlib, {load_zlib, unload_zlib}},
- #endif
- diff -urdN kmod-29.orig/libkmod/libkmod.pc.in kmod-29/libkmod/libkmod.pc.in
- --- kmod-29.orig/libkmod/libkmod.pc.in 2020-09-11 06:55:01.331987063 +0200
- +++ kmod-29/libkmod/libkmod.pc.in 2022-02-27 13:55:12.920445685 +0100
- @@ -7,5 +7,5 @@
- Description: Library to deal with kernel modules
- Version: @VERSION@
- Libs: -L${libdir} -lkmod
- -Libs.private: @libzstd_LIBS@ @liblzma_LIBS@ @zlib_LIBS@
- +Libs.private: @libzstd_LIBS@ @liblzma_LIBS@ @lzlib_LIBS@ @zlib_LIBS@
- Cflags: -I${includedir}
- diff -urdN kmod-29.orig/man/Makefile.in kmod-29/man/Makefile.in
- --- kmod-29.orig/man/Makefile.in 2021-05-21 01:02:52.665601480 +0200
- +++ kmod-29/man/Makefile.in 2022-02-27 13:55:12.920445685 +0100
- @@ -278,6 +278,8 @@
- libzstd_LIBS = @libzstd_LIBS@
- localedir = @localedir@
- localstatedir = @localstatedir@
- +lzlib_CFLAGS = @lzlib_CFLAGS@
- +lzlib_LIBS = @lzlib_LIBS@
- mandir = @mandir@
- mkdir_p = @mkdir_p@
- oldincludedir = @oldincludedir@
- diff -urdN kmod-29.orig/shared/util.c kmod-29/shared/util.c
- --- kmod-29.orig/shared/util.c 2020-09-11 06:55:01.331987063 +0200
- +++ kmod-29/shared/util.c 2022-02-27 13:55:12.920445685 +0100
- @@ -43,6 +43,9 @@
- #ifdef ENABLE_ZLIB
- {".ko.gz", sizeof(".ko.gz") - 1},
- #endif
- +#ifdef ENABLE_LZLIB
- + {".ko.lz", sizeof(".ko.lz") - 1},
- +#endif
- #ifdef ENABLE_XZ
- {".ko.xz", sizeof(".ko.xz") - 1},
- #endif
- diff -urdN kmod-29.orig/testsuite/test-util.c kmod-29/testsuite/test-util.c
- --- kmod-29.orig/testsuite/test-util.c 2020-09-11 06:55:01.331987063 +0200
- +++ kmod-29/testsuite/test-util.c 2022-02-27 13:55:12.920445685 +0100
- @@ -154,6 +154,9 @@
- #ifdef ENABLE_ZLIB
- { "/bla.ko.gz", true },
- #endif
- +#ifdef ENABLE_LZLIB
- + { "/bla.ko.lz", true },
- +#endif
- #ifdef ENABLE_XZ
- { "/bla.ko.xz", true },
- #endif
|