Jan Engelhardt 2016-07-21 10:08:59 +00:00 committed by Git OBS Bridge
parent d5358f069e
commit 0fde1c43f8
9 changed files with 39 additions and 151 deletions

View File

@ -1,93 +0,0 @@
From d1a89109faebc3db7e01d10fb8ac6f9dd2332a8f Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 16 Jun 2016 09:18:52 +0200
Subject: [PATCH] libkmod: Handle long lines in /proc/modules
Patch-mainline: Submitted to linux-modules@vger.kernel.org on 2016-06-17
References: bsc#983754
kmod_module_new_from_loaded() calls fgets with a 4k buffer. When a
module such as usbcore is used by too many modules, the rest of the line
is considered a beginning of another lines and we eventually get errors
like these from lsmod:
libkmod: kmod_module_get_holders: could not open '/sys/module/100,/holders': No such file or directory
together with bogus entries in the output. In kmod_module_get_size, the
problem does not affect functionality, but the line numbers in error
messages will be wrong.
Signed-off-by: Michal Marek <mmarek@suse.com>
---
I wrote a test case for this as well, but it is failing because the
testsuite itself has problems with output larger than 4k. I'll send
something later.
Also, the buffer could be shrinked now, so that we do not use that much
space on stack. Not sure if this is of interest or not. I left it as is.
Michal
---
libkmod/libkmod-module.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 1460c6746cc4..25dcda7667b7 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1660,13 +1660,14 @@ KMOD_EXPORT int kmod_module_new_from_loaded(struct kmod_ctx *ctx,
struct kmod_module *m;
struct kmod_list *node;
int err;
+ size_t len = strlen(line);
char *saveptr, *name = strtok_r(line, " \t", &saveptr);
err = kmod_module_new_from_name(ctx, name, &m);
if (err < 0) {
ERR(ctx, "could not get module from name '%s': %s\n",
name, strerror(-err));
- continue;
+ goto eat_line;
}
node = kmod_list_append(l, m);
@@ -1676,6 +1677,9 @@ KMOD_EXPORT int kmod_module_new_from_loaded(struct kmod_ctx *ctx,
ERR(ctx, "out of memory\n");
kmod_module_unref(m);
}
+eat_line:
+ while (line[len - 1] != '\n' && fgets(line, sizeof(line), fp))
+ len = strlen(line);
}
fclose(fp);
@@ -1825,12 +1829,13 @@ KMOD_EXPORT long kmod_module_get_size(const struct kmod_module *mod)
}
while (fgets(line, sizeof(line), fp)) {
+ size_t len = strlen(line);
char *saveptr, *endptr, *tok = strtok_r(line, " \t", &saveptr);
long value;
lineno++;
if (tok == NULL || !streq(tok, mod->name))
- continue;
+ goto eat_line;
tok = strtok_r(NULL, " \t", &saveptr);
if (tok == NULL) {
@@ -1848,6 +1853,9 @@ KMOD_EXPORT long kmod_module_get_size(const struct kmod_module *mod)
size = value;
break;
+eat_line:
+ while (line[len - 1] != '\n' && fgets(line, sizeof(line), fp))
+ len = strlen(line);
}
fclose(fp);
--
2.6.2

View File

@ -1,27 +0,0 @@
Subject: [PATCH] depmod: Ignore PowerPC64 ABIv2 .TOC. symbo
The .TOC. symbol on the PowerPC64 ABIv2 identifies the GOT
pointer, similar to how other architectures use _GLOBAL_OFFSET_TABLE_.
This is not a symbol that needs relocation, and should be ignored
by depmod.
---
tools/depmod.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/depmod.c b/tools/depmod.c
index 6e9bb4d..a2e07c1 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2153,6 +2153,8 @@ static void depmod_add_fake_syms(struct depmod *depmod)
depmod_symbol_add(depmod, "__this_module", true, 0, NULL);
/* On S390, this is faked up too */
depmod_symbol_add(depmod, "_GLOBAL_OFFSET_TABLE_", true, 0, NULL);
+ /* On PowerPC64 ABIv2, .TOC. is more or less _GLOBAL_OFFSET_TABLE_ */
+ depmod_symbol_add(depmod, "TOC.", true, 0, NULL);
}
static int depmod_load_symvers(struct depmod *depmod, const char *filename)
--
2.5.0

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJWS8KQAAoJEJuipaYwy+pTtI4P+gM1moO6Qt3CEP1GCfZPek9F
+2MxgtWnttSwroJ1PnQowv/yJtAtjnyBr78KK2M79g3XWRn2zXbf8+7S49dgrcpO
f7lHrvP+WIzTtS4mk7GTUk7LX8fUUOWr3na2aO6Cv2diJRW9JBKHWWzij5Wa0Zvn
JnA8b2CxweJp7KBcf+GxcLBkUrN5/5Qfej8KCK9pp4RUt1ks6vUTYaFjZHugr8ks
4U6GQbaFqpICpVd1k3qj/kfgftkPkQUcOL7MfK+LBtPuyA4rycy01hsESrB05gaJ
lw6dcmCAcI7xoI/2EpqD9D5pBGMR13IbBb4KmO2CdE30cQxT/R4oH1mt+Dbn3kwl
s185nSCqe7yo+F+qYmdqAy+u76yjXnlVl9/CpOBTkRkC0U8zq/QmnyBDZyYrcl5k
3z9UH+p5Y0lXFopbljEdGJfiLCWjP7g1ynqQl4mVL3ymfu0nW5/7/bsQq8lh20uh
c0u0qLAKzsL6XlO1YN60tzDHv43cZ3UoEtlNozJgLcNGM2KyrQsonwPtqMjNCSzw
xqQHcJZvcO1C3TLQ4FYGHfpN8/kNK3LpWLV7D+WHfZRQnU7MwuPkU7cUJrt4uh8w
IislcX/AbkbZ7VG81IaV/ni5jVfFBfnxFnW2xIgO2cN4xkTo8TVt1Qw0kF+TYaD7
st8UBrgP1xKixic51979
=vwC8
-----END PGP SIGNATURE-----

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba3b1ddea33228b473189fcb05b809024a3b86e9a7cf37d420cae06beb749f82
size 449724

17
kmod-23.tar.sign Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJXjwCUAAoJEJuipaYwy+pTgAoQAKLpfyFbLpUqcxpjWPgFD+Ei
1/Ls0SQIlnhgtX+mpXuFMS2eV5hdrozbc3EJ57x3mbPFi6KbVP9UQBnLF2e1glam
QZrjq4O7ae3OApCFCu/+q8XLz8M1n82etKANBez/tbZjmqvg5+gFnlXWDC4bhQeI
3i32RJtkHw94kThNR0+L4w+whG2xU9VOgh/OMbAf9m29uoJzBsNXZTO3+YuzvbtT
JYmPokaOjIBGMG/lPmKEVq5a5kkeSJ4UvTPYV+NlB87UAahzSSPZP4h9MXQaoQy6
wP6ivqM8vW7EyXeTuyfOh/7+DV58xjP1Amjm2dTi412cQfSUjUC0fuOkbDTib/Ul
Ro6YtQoRS/ILES1YhwWzM19GIcZjEeMF58WHZVEnrTXq0xq2wCmt2MeBl24xX5EJ
wcocat3FcqHFaGmaLjMItqDwHhJrhbxnKJC3lpKmIvmdvyD1DyXeylxBX0RACn07
kyV01JTFH+JefbUyS3vo5OnciTH6THJ9qHNL/ApjOf5htWUKthgW5SzqV073zXYp
Pc81EEFH2v7IMt4gCHPdbZ6AwAqcJVB+pLinttnNN6gQfmhfFpdBmC0u1SI9NBRF
EOHFsIQmdbfHuSXmSZzjjjBtsSl868u+aIyJE+tqLKMEc1zoMYh6nIm4nZaIkZgP
z14K+bbua25I+M8TW6BF
=PTLr
-----END PGP SIGNATURE-----

3
kmod-23.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d303d5519faec9d69e1132f6b37db2579db17a7fb5c1517da0115d03ba168155
size 450376

View File

@ -18,7 +18,7 @@
Name: kmod-testsuite
%define lname libkmod2
Version: 22
Version: 23
Release: 0
Summary: Testsuite of the kmod package
License: LGPL-2.1+ and GPL-2.0+
@ -36,8 +36,6 @@ Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch
Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch7: 0001-use-correct-sort-method-in-test-array.patch
Patch8: depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch
Patch9: 0001-libkmod-Handle-long-lines-in-proc-modules.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
@ -63,7 +61,7 @@ buildloop with the kernel.
%prep
%setup -q -n kmod-%version
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -P 7 -P 8 -P 9 -p1
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -P 7 -p1
%build
autoreconf -fi

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Jul 21 09:56:02 UTC 2016 - jengelh@inai.de
- Update to new upstream release 23
* Don't add comment to modules.devname if it would otherwise be
empty.
* Ignore .TOC. symbols in depmod parsing.
* Fix crash on modinfo while checking for available signature of
unknown type.
* Teach modinfo about PKCS#7 module signatures.
- Drop depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch (merged),
0001-libkmod-Handle-long-lines-in-proc-modules.patch (merged)
-------------------------------------------------------------------
Fri Jun 17 15:18:29 UTC 2016 - mmarek@suse.cz

View File

@ -18,13 +18,12 @@
Name: kmod
%define lname libkmod2
Version: 22
Version: 23
Release: 0
Summary: Utilities to load modules into the kernel
License: LGPL-2.1+ and GPL-2.0+
Group: System/Kernel
Url: http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-module-init-tools/
#Announce: https://lwn.net/Articles/664801/
Url: https://www.kernel.org/pub/linux/utils/kernel/kmod/
#Git-Web: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
@ -36,8 +35,6 @@ Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch
Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch7: 0001-use-correct-sort-method-in-test-array.patch
Patch8: depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch
Patch9: 0001-libkmod-Handle-long-lines-in-proc-modules.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
@ -103,7 +100,7 @@ in %lname.
%prep
%setup -q -n kmod-%version
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -P 7 -P 8 -P 9 -p1
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -P 7 -p1
%build
autoreconf -fi
@ -155,7 +152,7 @@ ln -s "%_bindir/kmod" "$b/bin/";
ls -l "$b/%_libdir/"
%if "%_libdir" != "/%_lib"
ln -s "%_libdir/libkmod.so.2" "$b/%_lib/";
ln -s "%_libdir/libkmod.so.2.3.0" "$b/%_lib/";
ln -s "%_libdir/libkmod.so.2.2.7" "$b/%_lib/";
%endif
%post