diff --git a/srcpkgs/kmod/patches/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch b/srcpkgs/kmod/patches/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch new file mode 100644 index 00000000000..cf0bbe43f09 --- /dev/null +++ b/srcpkgs/kmod/patches/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch @@ -0,0 +1,34 @@ +From c7d5a60d3df735a3816bbc1ff1b416a803a4f7a6 Mon Sep 17 00:00:00 2001 +From: Dave Reisner +Date: Mon, 7 May 2012 19:41:41 -0400 +Subject: [PATCH 1/2] libkmod-file: gracefully handle errors from zlib + +zlib won't necessarily set the system errno, and this is particularly +evident on corrupted data (which results in a double free). Use zlib's +gzerror to detect the failure, returning a generic EINVAL when zlib +doesn't provide us with an errno. +--- + libkmod/libkmod-file.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c +index 46ad8d9..8beb7e3 100644 +--- libkmod/libkmod-file.c ++++ libkmod/libkmod-file.c +@@ -199,7 +199,13 @@ static int load_zlib(struct kmod_file *file) + if (r == 0) + break; + else if (r < 0) { +- err = -errno; ++ int gzerr; ++ const char *gz_errmsg = gzerror(file->gzf, &gzerr); ++ ++ ERR(file->ctx, "gzip: %s\n", gz_errmsg); ++ ++ /* gzip might not set errno here */ ++ err = gzerr == Z_ERRNO ? -errno : -EINVAL; + goto error; + } + did += r; +-- +1.7.10.1 diff --git a/srcpkgs/kmod/patches/0002-depmod-report-failures-in-loading-symbols.patch b/srcpkgs/kmod/patches/0002-depmod-report-failures-in-loading-symbols.patch new file mode 100644 index 00000000000..4046a61877d --- /dev/null +++ b/srcpkgs/kmod/patches/0002-depmod-report-failures-in-loading-symbols.patch @@ -0,0 +1,33 @@ +From 819f79a24d58e3c8429f1631df2f8f85a2f95d4a Mon Sep 17 00:00:00 2001 +From: Dave Reisner +Date: Mon, 7 May 2012 19:41:42 -0400 +Subject: [PATCH 2/2] depmod: report failures in loading symbols + +Previously, depmod would relegate failures of kmod_module_get_symbols() +to debug output, assuming the "error" was simply a lack of symbols. +Leave the ENOENT return to debug output, but report anything else as a +real error. +--- + tools/kmod-depmod.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tools/kmod-depmod.c b/tools/kmod-depmod.c +index e89dff6..bceb407 100644 +--- tools/kmod-depmod.c ++++ tools/kmod-depmod.c +@@ -1542,8 +1542,11 @@ static int depmod_load_symbols(struct depmod *depmod) + struct kmod_list *l, *list = NULL; + int err = kmod_module_get_symbols(mod->kmod, &list); + if (err < 0) { +- DBG("ignoring %s: no symbols: %s\n", +- mod->path, strerror(-err)); ++ if (err == -ENOENT) ++ DBG("ignoring %s: no symbols\n", mod->path); ++ else ++ ERR("failed to load symbols from %s: %s\n", ++ mod->path, strerror(-err)); + continue; + } + kmod_list_foreach(l, list) { +-- +1.7.10.1 diff --git a/srcpkgs/kmod/template b/srcpkgs/kmod/template index ed720f19a31..d64a27da6bc 100644 --- a/srcpkgs/kmod/template +++ b/srcpkgs/kmod/template @@ -1,11 +1,15 @@ # Template file for 'kmod' pkgname=kmod version=8 +revision=1 homepage="http://git.profusion.mobi/cgit.cgi/kmod.git" distfiles="${KERNEL_SITE}/utils/kernel/kmod/kmod-${version}.tar.xz" build_style=gnu-configure configure_args="--with-rootprefix= --with-zlib --with-xz" makedepends="pkg-config zlib-devel liblzma-devel" +provides="module-init-tools-3.17" +replaces="module-init-tools>=0" +subpackages="libkmod libkmod-devel" short_desc="Linux kernel module handling" maintainer="Juan RP " license="GPL-2" @@ -16,17 +20,12 @@ long_desc=" These tools are designed on top of libkmod, a library that is shipped with kmod." -provides="module-init-tools-3.17" -replaces="module-init-tools>=0" -subpackages="libkmod libkmod-devel" - make_dirs=" /etc/depmod.d 0755 root root /etc/modprobe.d 0755 root root /lib/depmod.d 0755 root root /lib/modprobe.d 0755 root root" - post_install() { vinstall ${FILESDIR}/depmod-search.conf 644 lib/depmod.d search.conf # add symlinks to kmod