Update kmod and zlib

This commit is contained in:
Manuel 2012-06-02 22:07:19 +00:00
parent 9692264f36
commit a5bd6bc646
10 changed files with 245 additions and 116 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
--- 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

View File

@ -1,28 +0,0 @@
From 269de2e0bf5011072da2f40f4f2d4023fad696b9 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Date: Tue, 7 Feb 2012 09:48:59 -0200
Subject: [PATCH] libkmod-module: probe: Fix ignore-loaded flag not being
applied
---
TODO | 3 +++
libkmod/libkmod-module.c | 3 ++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 0af3e2e..b5eb7c9 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1132,7 +1132,8 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
if (mod == NULL)
return -ENOENT;
- if (module_is_inkernel(mod)) {
+ if (!(flags & KMOD_PROBE_IGNORE_LOADED)
+ && module_is_inkernel(mod)) {
if (flags & KMOD_PROBE_FAIL_ON_LOADED)
return -EEXIST;
else
--
1.7.9

View File

@ -1,39 +0,0 @@
From 8cd0f9e4f9f5c093136a7a2c0c2998b9dd203161 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Date: Sat, 11 Feb 2012 19:45:29 -0200
Subject: [PATCH] libkmod-module: probe: fix infinite loop with softdeps
If a softdep depends on a module in the dependency list of the module
being inserted, we would enter and infinite loop.
Move the "mod->visited = true" assignment to the proper place, hoping it
didn't break other use cases. This is a bug that comes and goes every
now and then. Since we have a testsuite now, a test for this should be
written.
---
libkmod/libkmod-module.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index b5eb7c9..835896f 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1013,7 +1013,6 @@ static int __kmod_module_fill_softdep(struct kmod_module *mod,
goto fail;
}
*list = l;
- mod->visited = true;
mod->ignorecmd = (pre != NULL || post != NULL);
kmod_list_foreach(l, post) {
@@ -1043,6 +1042,7 @@ static int __kmod_module_get_probe_list(struct kmod_module *mod,
mod->name);
return 0;
}
+ mod->visited = true;
dep = kmod_module_get_dependencies(mod);
kmod_list_foreach(l, dep) {
--
1.7.9

View File

@ -0,0 +1,49 @@
From 666ba68a0635048aea0db70cd9ec61aea9b61ed2 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sat, 3 Mar 2012 12:37:06 +0100
Subject: [PATCH 1/2] split usr: read configs from /lib/{depmod.d,modprobe.d}
This allows rootprefix to be set to /usr, even if not all other packages
have been fixed to read from this dir.
---
libkmod/libkmod.c | 5 +++--
tools/kmod-depmod.c | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 36ca629..12c1112 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -62,6 +62,7 @@ static const char *default_config_paths[] = {
SYSCONFDIR "/modprobe.d",
"/run/modprobe.d",
ROOTPREFIX "/lib/modprobe.d",
+ "/lib/modprobe.d",
NULL
};
@@ -223,8 +224,8 @@ static char *get_kernel_release(const char *dirname)
* @config_paths: ordered array of paths (directories or files) where
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If
- * NULL defaults to /run/modprobe.d, /etc/modprobe.d and
- * $rootprefix/lib/modprobe.d. Give an empty vector if
+ * NULL defaults to /run/modprobe.d, /etc/modprobe.d,
+ * $rootprefix/lib/modprobe.d and /lib/modprobe.d. Give an empty vector if
* configuration should not be read. This array must be null
* terminated.
*
diff --git a/tools/kmod-depmod.c b/tools/kmod-depmod.c
index 1871e18..7bb1c5d 100644
--- a/tools/kmod-depmod.c
+++ b/tools/kmod-depmod.c
@@ -58,6 +58,7 @@ static const char *default_cfg_paths[] = {
"/run/depmod.d",
SYSCONFDIR "/depmod.d",
ROOTPREFIX "/lib/depmod.d",
+ "/lib/depmod.d",
NULL
};
--
1.7.9.5

View File

@ -0,0 +1,92 @@
From 53e7e0e42428770578ca0d54d0a9540f498f917f Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sat, 31 Mar 2012 12:17:39 +0200
Subject: [PATCH 2/2] config: hardcode the path to modules to be /lib/modules
This means that we can move the configuration paths from /lib
to /usr/lib without having to touch the kernel and related
packages.
That can be dealt with separately at a later location, in which case
all we have to do is revert this patch.
Signed-off-by: Tom Gundersen <teg@jklm.no>
---
libkmod/libkmod.c | 2 +-
tools/kmod-depmod.c | 2 +-
tools/kmod-modinfo.c | 4 ++--
tools/kmod-modprobe.c | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 12c1112..11edfa0 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -196,7 +196,7 @@ static int log_priority(const char *priority)
return 0;
}
-static const char *dirname_default_prefix = ROOTPREFIX "/lib/modules";
+static const char *dirname_default_prefix = "/lib/modules";
static char *get_kernel_release(const char *dirname)
{
diff --git a/tools/kmod-depmod.c b/tools/kmod-depmod.c
index 7bb1c5d..454d538 100644
--- a/tools/kmod-depmod.c
+++ b/tools/kmod-depmod.c
@@ -2634,7 +2634,7 @@ static int do_depmod(int argc, char *argv[])
}
cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
- "%s" ROOTPREFIX "/lib/modules/%s",
+ "%s/lib/modules/%s",
root == NULL ? "" : root, cfg.kversion);
if (optind == argc)
diff --git a/tools/kmod-modinfo.c b/tools/kmod-modinfo.c
index aa5223f..b13cd4b 100644
--- a/tools/kmod-modinfo.c
+++ b/tools/kmod-modinfo.c
@@ -339,7 +339,7 @@ static void help(const char *progname)
"\t-0, --null Use \\0 instead of \\n\n"
"\t-F, --field=FIELD Print only provided FIELD\n"
"\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n"
- "\t-b, --basedir=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
+ "\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
progname);
@@ -439,7 +439,7 @@ static int do_modinfo(int argc, char *argv[])
}
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s" ROOTPREFIX "/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
root, kversion);
dirname = dirname_buf;
}
diff --git a/tools/kmod-modprobe.c b/tools/kmod-modprobe.c
index 4760682..ccb41d8 100644
--- a/tools/kmod-modprobe.c
+++ b/tools/kmod-modprobe.c
@@ -128,7 +128,7 @@ static void help(const char *progname)
"\t-n, --show Same as --dry-run\n"
"\t-C, --config=FILE Use FILE instead of default search paths\n"
- "\t-d, --dirname=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
+ "\t-d, --dirname=DIR Use DIR as filesystem root for /lib/modules\n"
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
"\t-s, --syslog print to syslog, not stderr\n"
@@ -973,7 +973,7 @@ static int do_modprobe(int argc, char **orig_argv)
kversion = u.release;
}
snprintf(dirname_buf, sizeof(dirname_buf),
- "%s" ROOTPREFIX "/lib/modules/%s", root,
+ "%s/lib/modules/%s", root,
kversion);
dirname = dirname_buf;
}
--
1.7.9.5

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
--- 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

View File

@ -1,11 +1,10 @@
#
# Chakra Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
pkgname=kmod
pkgver=6
pkgver=8
pkgrel=1
pkgdesc="Linux kernel module handling"
arch=('i686' 'x86_64')
@ -17,25 +16,45 @@ provides=('module-init-tools=3.16')
conflicts=('module-init-tools')
replaces=('module-init-tools')
source=("ftp://ftp.kernel.org/pub/linux/utils/kernel/$pkgname/$pkgname-$pkgver.tar.xz"
"depmod-search.conf")
md5sums=('bad08102fad212cd34405136d9a7eb94'
'285fc738c220ff84419995fc8c6d6ca1')
"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"
"0001-libkmod-file-gracefully-handle-errors-from-zlib.patch"
"0002-depmod-report-failures-in-loading-symbols.patch")
md5sums=('d4e3d038b5370b1e8ff237c55666aa64'
'285fc738c220ff84419995fc8c6d6ca1'
'1a1feb93633384655e668eb3a22729ac'
'bcd3a0b2d1922f4960e7f7778ae2577f'
'ce4b6a0679a0c933251b20b848d6a524'
'1f443aba41dee586d46c3abb35912c6a')
build() {
cd "$pkgname-$pkgver"
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 \
--with-zlib
--with-zlib \
--with-rootprefix=/usr
make
}
check() {
make -C "$pkgname-$pkgver" check
}
package() {
make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install
# extra directories
install -dm755 "$pkgdir"/{etc,lib}/{depmod,modprobe}.d "$pkgdir/sbin"
install -dm755 "$pkgdir"/{etc,usr/lib}/{depmod,modprobe}.d "$pkgdir/sbin"
# add symlinks to kmod
ln -s ../usr/bin/kmod "$pkgdir/sbin/modprobe"
@ -46,7 +65,5 @@ package() {
done
# install depmod.d file for search/ dir
install -Dm644 "$srcdir/depmod-search.conf" "$pkgdir/lib/depmod.d/search.conf"
install -Dm644 "$srcdir/depmod-search.conf" "$pkgdir/usr/lib/depmod.d/search.conf"
}
# vim: ft=sh syn=sh et

View File

@ -1,35 +1,32 @@
#
# Chakra Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
pkgname=zlib
pkgver=1.2.5
pkgrel=3
pkgver=1.2.7
pkgrel=1
pkgdesc='Compression library implementing the deflate compression method found in gzip and PKZIP'
arch=('i686' 'x86_64')
license=('custom')
url="http://www.zlib.net/"
depends=('glibc')
options=('!makeflags' 'log')
source=("http://zlib.net/zlib-${pkgver}.tar.gz"
'zlib-1.2.5-lfs-decls.patch')
md5sums=('c735eab2d659a96e5a594c9e8541ad63'
'4cb279ea3beab621f3526bf7b7ab99e5')
source=("http://zlib.net/current/zlib-${pkgver}.tar.gz")
md5sums=('60df6a37c56e7c1366cca812414f7b85')
build() {
cd ${srcdir}/zlib-$pkgver
# see http://bugs.archlinux.org/task/19280
patch -p1 -i ${srcdir}/zlib-1.2.5-lfs-decls.patch || return 1
# work around gcc bug; see https://bugs.archlinux.org/task/20647
export CFLAGS="${CFLAGS/-O2/-O3} -fno-tree-vectorize -DUNALIGNED_OK"
./configure --prefix=/usr
make
grep -A 24 '^ Copyright' zlib.h > LICENSE
}
check() {
cd ${srcdir}/zlib-$pkgver
make test
}
package() {
cd ${srcdir}/zlib-$pkgver
make install DESTDIR=${pkgdir}

View File

@ -1,13 +0,0 @@
Index: zlib-1.2.5/zlib.h
===================================================================
--- zlib-1.2.5.orig/zlib.h
+++ zlib-1.2.5/zlib.h
@@ -1578,7 +1578,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF(
# define gzoffset gzoffset64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
-# ifdef _LARGEFILE64_SOURCE
+# ifndef _LARGEFILE64_SOURCE
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));

View File

@ -1,13 +0,0 @@
Index: zlib-1.2.5/zlib.h
===================================================================
--- zlib-1.2.5.orig/zlib.h
+++ zlib-1.2.5/zlib.h
@@ -1578,7 +1578,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF(
# define gzoffset gzoffset64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
-# ifdef _LARGEFILE64_SOURCE
+# ifndef _LARGEFILE64_SOURCE
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));