kmod: add 2 patches from git via Arch.

This commit is contained in:
Juan RP 2012-05-29 22:38:50 +02:00
parent 9cf8706cad
commit 795f9182c2
3 changed files with 71 additions and 5 deletions

View File

@ -0,0 +1,34 @@
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
--- 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

View File

@ -0,0 +1,33 @@
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
--- 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

View File

@ -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 <xtraeme@gmail.com>"
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