summaryrefslogtreecommitdiff
path: root/core/kmod
diff options
context:
space:
mode:
Diffstat (limited to 'core/kmod')
-rw-r--r--core/kmod/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch35
-rw-r--r--core/kmod/0002-depmod-report-failures-in-loading-symbols.patch34
-rw-r--r--core/kmod/PKGBUILD20
3 files changed, 83 insertions, 6 deletions
diff --git a/core/kmod/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch b/core/kmod/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch
new file mode 100644
index 000000000..30c92b280
--- /dev/null
+++ b/core/kmod/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch
@@ -0,0 +1,35 @@
+From c7d5a60d3df735a3816bbc1ff1b416a803a4f7a6 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner@archlinux.org>
+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
+--- a/libkmod/libkmod-file.c
++++ b/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/core/kmod/0002-depmod-report-failures-in-loading-symbols.patch b/core/kmod/0002-depmod-report-failures-in-loading-symbols.patch
new file mode 100644
index 000000000..90c58d5da
--- /dev/null
+++ b/core/kmod/0002-depmod-report-failures-in-loading-symbols.patch
@@ -0,0 +1,34 @@
+From 819f79a24d58e3c8429f1631df2f8f85a2f95d4a Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner@archlinux.org>
+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
+--- a/tools/kmod-depmod.c
++++ b/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/core/kmod/PKGBUILD b/core/kmod/PKGBUILD
index b7b888031..65a607ea4 100644
--- a/core/kmod/PKGBUILD
+++ b/core/kmod/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 157131 2012-04-24 12:21:20Z dreisner $
+# $Id: PKGBUILD 158851 2012-05-12 13:02:54Z dreisner $
# Maintainer: Dave Reisner <dreisner@archlinux.org>
pkgname=kmod
pkgver=8
-pkgrel=1
+pkgrel=2
pkgdesc="Linux kernel module handling"
arch=('i686' 'x86_64')
url='http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary'
@@ -16,17 +16,25 @@ replaces=('module-init-tools')
source=("ftp://ftp.kernel.org/pub/linux/utils/kernel/$pkgname/$pkgname-$pkgver.tar.xz"
"depmod-search.conf"
"0001-split-usr-read-configs-from-lib-depmod.d-modprobe.d.patch"
- "0002-config-hardcode-the-path-to-modules-to-be-lib-module.patch")
+ "0002-config-hardcode-the-path-to-modules-to-be-lib-module.patch"
+ "0001-libkmod-file-gracefully-handle-errors-from-zlib.patch"
+ "0002-depmod-report-failures-in-loading-symbols.patch")
md5sums=('d4e3d038b5370b1e8ff237c55666aa64'
'dd62cbf62bd8f212f51ef8c43bec9a77'
'ba73b9e98db1abbf41274f922fcfbd55'
- 'c9af56636c5667cf4ce3a31ea56e03d9')
+ 'c9af56636c5667cf4ce3a31ea56e03d9'
+ '1a877b9863b94f91c8d3aec97c021c6b'
+ '1a9f132779f90556852e70279577ed22')
build() {
cd "$pkgname-$pkgver"
- patch -p1 -i ../0001-split-usr-read-configs-from-lib-depmod.d-modprobe.d.patch
- patch -p1 -i ../0002-config-hardcode-the-path-to-modules-to-be-lib-module.patch
+ patch -Np1 <"$srcdir"/0001-split-usr-read-configs-from-lib-depmod.d-modprobe.d.patch
+ patch -Np1 <"$srcdir"/0002-config-hardcode-the-path-to-modules-to-be-lib-module.patch
+
+ # fix crash on corrupted zlib compression
+ patch -Np1 <"$srcdir"/0001-libkmod-file-gracefully-handle-errors-from-zlib.patch
+ patch -Np1 <"$srcdir"/0002-depmod-report-failures-in-loading-symbols.patch
./configure \
--sysconfdir=/etc \