Accepting request 229356 from home:michal-m:branches:Base:System

- Remove th now obsolete test-files.tar.xz tarball
  (thanks to Jan Engelhardt)

- Updated to kmod 17
  - Do not require xsltproc for build
  - Parse softdeps stored in kernel modules
  - Add experimental python bindings (not enabled in the package
    yet)
  - Misc bugfixes
- Deleted patches that went upstream. Only the unsupported modules
  feature remains:
  0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
  0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch
  0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
  0010-modprobe-Implement-allow-unsupported-modules.patch

OBS-URL: https://build.opensuse.org/request/show/229356
OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=68
This commit is contained in:
Jan Engelhardt 2014-04-08 08:48:24 +00:00 committed by Git OBS Bridge
parent 8e0db140ab
commit ccce001018
14 changed files with 45 additions and 861 deletions

View File

@ -1,97 +0,0 @@
From abf0e3b4ddb0c7348492309f8ccccdcafba91b2f Mon Sep 17 00:00:00 2001
From: Stephen Kitt <steve@sk2.org>
Date: Sun, 26 Jan 2014 18:00:23 -0200
Subject: [PATCH 01/10] Remove "rmmod -w" documentation and getopt entry
This patch removes the cmdopts declaration and the documentation. They
were leftover from the -w removal.
Patch-mainline: v17
Git-commit: a4bd1441e5c7e8903a9ae065801d4f06f13d06e9
[mmarek: regenerated man/rmmod.8]
---
man/rmmod.8 | 12 +-----------
man/rmmod.xml | 17 -----------------
tools/rmmod.c | 1 -
3 files changed, 1 insertion(+), 29 deletions(-)
diff --git a/man/rmmod.8 b/man/rmmod.8
index cd97efa..e5d879a 100644
--- a/man/rmmod.8
+++ b/man/rmmod.8
@@ -31,7 +31,7 @@
rmmod \- Simple program to remove a module from the Linux Kernel
.SH "SYNOPSIS"
.HP \w'\fBrmmod\fR\ 'u
-\fBrmmod\fR [\fB\-f\fR] [\fB\-w\fR] [\fB\-s\fR] [\fB\-v\fR] [\fImodulename\fR]
+\fBrmmod\fR [\fB\-f\fR] [\fB\-s\fR] [\fB\-v\fR] [\fImodulename\fR]
.SH "DESCRIPTION"
.PP
\fBrmmod\fR
@@ -55,16 +55,6 @@ This option can be extremely dangerous: it has no effect unless CONFIG_MODULE_FO
\fBlsmod\fR(8))\&.
.RE
.PP
-\fB\-w\fR \fB\-\-wait\fR
-.RS 4
-Normally,
-\fBrmmod\fR
-will refuse to unload modules which are in use\&. With this option,
-\fBrmmod\fR
-will isolate the module, and wait until the module is no longer used\&. Nothing new will be able to use the module, but it\*(Aqs up to you to make sure the current users eventually finish with it\&. See
-\fBlsmod\fR(8)) for information on usage counts\&.
-.RE
-.PP
\fB\-s\fR, \fB\-\-syslog\fR
.RS 4
Send errors to syslog instead of standard error\&.
diff --git a/man/rmmod.xml b/man/rmmod.xml
index 3605068..5023fb0 100644
--- a/man/rmmod.xml
+++ b/man/rmmod.xml
@@ -39,7 +39,6 @@
<cmdsynopsis>
<command>rmmod</command>
<arg><option>-f</option></arg>
- <arg><option>-w</option></arg>
<arg><option>-s</option></arg>
<arg><option>-v</option></arg>
<arg><replaceable>modulename</replaceable></arg>
@@ -94,22 +93,6 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>-w</option> <option>--wait</option>
- </term>
- <listitem>
- <para>
- Normally, <command>rmmod</command> will refuse to unload modules
- which are in use. With this option, <command>rmmod</command> will
- isolate the module, and wait until the module is no longer used.
- Nothing new will be able to use the module, but it's up to you to
- make sure the current users eventually finish with it. See
- <citerefentry>
- <refentrytitle>lsmod</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>) for information on usage counts.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term>
<option>-s</option>
</term>
diff --git a/tools/rmmod.c b/tools/rmmod.c
index fd0fac5..df2f041 100644
--- a/tools/rmmod.c
+++ b/tools/rmmod.c
@@ -40,7 +40,6 @@ static const struct option cmdopts[] = {
{"syslog", no_argument, 0, 's'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
- {"wait", no_argument, 0, 'w'},
{"help", no_argument, 0, 'h'},
{NULL, 0, 0, 0}
};
--
1.8.4.5

View File

@ -1,97 +0,0 @@
From 4d392fa63af7f3fd09fdb49120864af1404d1a25 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 6 Mar 2014 18:03:46 +0100
Subject: [PATCH] testsuite: Fix uname() during glibc startup
In a specific configuration (chroot with the linux32 personality), the
modprobe_install_cmd_loop test failed, because the bash process handling
the install command segfaulted. The backtrace showed a uname() call
during libpthread initialization, at which point the environ pointer
hadn't been initialized yet:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x080c1591 in getenv (name=<optimized out>,
name@entry=0xf775f850 "TESTSUITE_UNAME_R") at getenv.c:81
81 for (i = 0, len = strlen (name); environ[i]; i++)
(gdb) bt
#0 0x080c1591 in getenv (name=<optimized out>,
name@entry=0xf775f850 "TESTSUITE_UNAME_R") at getenv.c:81
#1 0xf775f754 in uname (u=u@entry=0xff946350) at testsuite/uname.c:32
#2 0xf74ffc6c in is_smp_system ()
at ../nptl/sysdeps/unix/sysv/linux/i386/smp.h:39
#3 __pthread_initialize_minimal_internal () at nptl-init.c:460
#4 0xf74fe32c in _init () at ../sysdeps/i386/crti.S:74
#5 0x00000000 in ?? ()
(gdb) p environ
$1 = (char **) 0x0
I don't know why it only happend in the chroot, but glibc can call its
own functions and impose any restrictions before main() is started, so
we have to adapt.
Also, do not return error if there is an environment, but the
environment variable is not found. If uname() is called by kmod, then
the respective test will simply fail later. If it's something else
calling uname(), then we do not want to disturb the program.
Patch-mainline: v17
Git-commit: 632fb7b4634a540bb09af3b2004b3fe44cd4a214
---
testsuite/uname.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/testsuite/uname.c b/testsuite/uname.c
index 2ada200..f55c435 100644
--- a/testsuite/uname.c
+++ b/testsuite/uname.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
#include "testsuite.h"
@@ -29,17 +30,10 @@ TS_EXPORT int uname(struct utsname *u)
{
static void *nextlib = NULL;
static int (*nextlib_uname)(struct utsname *u);
- const char *release = getenv(S_TC_UNAME_R);
+ const char *release;
int err;
size_t sz;
- if (release == NULL) {
- fprintf(stderr, "TRAP uname(): missing export %s?\n",
- S_TC_UNAME_R);
- errno = EFAULT;
- return -1;
- }
-
if (nextlib == NULL) {
#ifdef RTLD_NEXT
nextlib = RTLD_NEXT;
@@ -53,6 +47,20 @@ TS_EXPORT int uname(struct utsname *u)
if (err < 0)
return err;
+ if (!environ)
+ /*
+ * probably called from within glibc before main(); unsafe
+ * to call getenv()
+ */
+ return 0;
+
+ release = getenv(S_TC_UNAME_R);
+ if (release == NULL) {
+ fprintf(stderr, "TRAP uname(): missing export %s?\n",
+ S_TC_UNAME_R);
+ return 0;
+ }
+
sz = strlen(release) + 1;
if (sz > sizeof(u->release)) {
fprintf(stderr, "uname(): sizeof release (%s) "
--
1.8.4.5

View File

@ -1,319 +0,0 @@
From 525e74c84547001548840f7a909350b366ed9b30 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 27 Feb 2014 22:23:31 +0100
Subject: [PATCH 04/10] testsuite: Check the list of loaded modules after a
test
Add a ->modules_loaded member to struct test, which is a comma-separated
list of modules that should be present after the test finishes. Both
missing and excess modules cause an error.
Patch-mainline: v17
Git-commit: 88ac40840f0d13aaca844bb7198c252178968878
---
testsuite/test-init.c | 1 +
testsuite/test-modprobe.c | 13 +++-
testsuite/testsuite.c | 189 +++++++++++++++++++++++++++++++++++++++++++++-
testsuite/testsuite.h | 2 +
4 files changed, 199 insertions(+), 6 deletions(-)
diff --git a/testsuite/test-init.c b/testsuite/test-init.c
index 63b6501..d2aa4bd 100644
--- a/testsuite/test-init.c
+++ b/testsuite/test-init.c
@@ -74,6 +74,7 @@ static DEFINE_TEST(test_insert,
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-init/",
[TC_INIT_MODULE_RETCODES] = "bla:1:20",
},
+ .modules_loaded = "ext4",
.need_spawn = true);
static noreturn int test_remove(const struct test *t)
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index 637d363..c3ef31e 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -91,7 +91,9 @@ static DEFINE_TEST(modprobe_show_alias_to_none,
},
.output = {
.out = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
- });
+ },
+ .modules_loaded = "",
+ );
static noreturn int modprobe_builtin(const struct test *t)
@@ -131,7 +133,9 @@ static DEFINE_TEST(modprobe_softdep_loop,
[TC_UNAME_R] = "4.4.4",
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/softdep-loop",
[TC_INIT_MODULE_RETCODES] = "",
- });
+ },
+ .modules_loaded = "btusb,bluetooth",
+ );
static noreturn int modprobe_install_cmd_loop(const struct test *t)
{
@@ -156,6 +160,7 @@ static DEFINE_TEST(modprobe_install_cmd_loop,
{ "MODPROBE", ABS_TOP_BUILDDIR "/tools/modprobe" },
{ }
},
+ .modules_loaded = "snd,snd-pcm",
);
static noreturn int modprobe_param_kcmdline(const struct test *t)
@@ -178,7 +183,9 @@ static DEFINE_TEST(modprobe_param_kcmdline,
},
.output = {
.out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline/correct.txt",
- });
+ },
+ .modules_loaded = "",
+ );
static const struct test *tests[] = {
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 9877a64..c29ca78 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
+#include <dirent.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -528,12 +529,189 @@ fail:
return true;
}
+static int cmp_modnames(const void *m1, const void *m2)
+{
+ const char *s1 = *(char *const *)m1;
+ const char *s2 = *(char *const *)m2;
+ int i;
+
+ for (i = 0; s1[i] || s2[i]; i++) {
+ char c1 = s1[i], c2 = s2[i];
+ if (c1 == '-')
+ c1 = '_';
+ if (c2 == '-')
+ c2 = '_';
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ return 0;
+}
+
+/*
+ * Store the expected module names in buf and return a list of pointers to
+ * them.
+ */
+static const char **read_expected_modules(const struct test *t,
+ char **buf, int *count)
+{
+ const char **res;
+ int len;
+ int i;
+ char *p;
+
+ if (t->modules_loaded[0] == '\0') {
+ *count = 0;
+ *buf = NULL;
+ return NULL;
+ }
+ *buf = strdup(t->modules_loaded);
+ if (!*buf) {
+ *count = -1;
+ return NULL;
+ }
+ len = 1;
+ for (p = *buf; *p; p++)
+ if (*p == ',')
+ len++;
+ res = malloc(sizeof(char *) * len);
+ if (!res) {
+ perror("malloc");
+ *count = -1;
+ free(*buf);
+ *buf = NULL;
+ return NULL;
+ }
+ i = 0;
+ res[i++] = *buf;
+ for (p = *buf; i < len; p++)
+ if (*p == ',') {
+ *p = '\0';
+ res[i++] = p + 1;
+ }
+ *count = len;
+ return res;
+}
+
+static char **read_loaded_modules(const struct test *t, char **buf, int *count)
+{
+ char dirname[PATH_MAX];
+ DIR *dir;
+ struct dirent *dirent;
+ int i;
+ int len = 0, bufsz;
+ char **res = NULL;
+ char *p;
+ const char *rootfs = t->config[TC_ROOTFS] ? t->config[TC_ROOTFS] : "";
+
+ /* Store the entries in /sys/module to res */
+ if (snprintf(dirname, sizeof(dirname), "%s/sys/module", rootfs)
+ >= (int)sizeof(dirname)) {
+ ERR("rootfs path too long: %s\n", rootfs);
+ *buf = NULL;
+ len = -1;
+ goto out;
+ }
+ dir = opendir(dirname);
+ /* not an error, simply return empty list */
+ if (!dir) {
+ *buf = NULL;
+ goto out;
+ }
+ bufsz = 0;
+ while ((dirent = readdir(dir))) {
+ if (dirent->d_name[0] == '.')
+ continue;
+ len++;
+ bufsz += strlen(dirent->d_name) + 1;
+ }
+ res = malloc(sizeof(char *) * len);
+ if (!res) {
+ perror("malloc");
+ len = -1;
+ goto out_dir;
+ }
+ *buf = malloc(bufsz);
+ if (!*buf) {
+ perror("malloc");
+ free(res);
+ res = NULL;
+ len = -1;
+ goto out_dir;
+ }
+ rewinddir(dir);
+ i = 0;
+ p = *buf;
+ while ((dirent = readdir(dir))) {
+ int size;
+
+ if (dirent->d_name[0] == '.')
+ continue;
+ size = strlen(dirent->d_name) + 1;
+ memcpy(p, dirent->d_name, size);
+ res[i++] = p;
+ p += size;
+ }
+out_dir:
+ closedir(dir);
+out:
+ *count = len;
+ return res;
+}
+
+static int check_loaded_modules(const struct test *t)
+{
+ int l1, l2, i1, i2;
+ const char **a1;
+ char **a2;
+ char *buf1, *buf2;
+ int err = false;
+
+ a1 = read_expected_modules(t, &buf1, &l1);
+ if (l1 < 0)
+ return err;
+ a2 = read_loaded_modules(t, &buf2, &l2);
+ if (l2 < 0)
+ goto out_a1;
+ qsort(a1, l1, sizeof(char *), cmp_modnames);
+ qsort(a2, l2, sizeof(char *), cmp_modnames);
+ i1 = i2 = 0;
+ err = true;
+ while (i1 < l1 || i2 < l2) {
+ int cmp;
+
+ if (i1 >= l1)
+ cmp = 1;
+ else if (i2 >= l2)
+ cmp = -1;
+ else
+ cmp = cmp_modnames(&a1[i1], &a2[i2]);
+ if (cmp == 0) {
+ i1++;
+ i2++;
+ } else if (cmp < 0) {
+ err = false;
+ ERR("module %s not loaded\n", a1[i1]);
+ i1++;
+ } else {
+ err = false;
+ ERR("module %s is loaded but should not be \n", a2[i2]);
+ i2++;
+ }
+ }
+ free(a2);
+ free(buf2);
+out_a1:
+ free(a1);
+ free(buf1);
+ return err;
+}
+
static inline int test_run_parent(const struct test *t, int fdout[2],
int fderr[2], int fdmonitor[2], pid_t child)
{
pid_t pid;
int err;
- bool matchout;
+ bool matchout, match_modules;
/* Close write-fds */
if (t->output.out != NULL)
@@ -578,16 +756,21 @@ static inline int test_run_parent(const struct test *t, int fdout[2],
if (matchout)
matchout = check_generated_files(t);
+ if (t->modules_loaded)
+ match_modules = check_loaded_modules(t);
+ else
+ match_modules = true;
if (t->expected_fail == false) {
if (err == 0) {
- if (matchout)
+ if (matchout && match_modules)
LOG("%sPASSED%s: %s\n",
ANSI_HIGHLIGHT_GREEN_ON, ANSI_HIGHLIGHT_OFF,
t->name);
else {
- ERR("%sFAILED%s: exit ok but outputs do not match: %s\n",
+ ERR("%sFAILED%s: exit ok but %s do not match: %s\n",
ANSI_HIGHLIGHT_RED_ON, ANSI_HIGHLIGHT_OFF,
+ matchout ? "loaded modules" : "outputs",
t->name);
err = EXIT_FAILURE;
}
diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h
index 97183cd..f2a75e5 100644
--- a/testsuite/testsuite.h
+++ b/testsuite/testsuite.h
@@ -95,6 +95,8 @@ struct test {
*/
const struct keyval *files;
} output;
+ /* comma-separated list of loaded modules at the end of the test */
+ const char *modules_loaded;
testfunc func;
const char *config[_TC_LAST];
const char *path;
--
1.8.4.5

View File

@ -1,59 +0,0 @@
From 5b532fd9616ba2a750e25378152bad4c9a2e7c27 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 27 Feb 2014 22:34:24 +0100
Subject: [PATCH 05/10] testsuite: Add test for modprobe --force
There is no check if the correct flags are passed to finit_module, but
at least we cover the respective code path in kmod.
Patch-mainline: v17
Git-commit: 2ce5de0ae6c191920a4eeeab757ccfad092d9e0f
[mmarek: Dropped binary files from the patch]
---
testsuite/test-modprobe.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index c3ef31e..92348b0 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -187,6 +187,28 @@ static DEFINE_TEST(modprobe_param_kcmdline,
.modules_loaded = "",
);
+static noreturn int modprobe_force(const struct test *t)
+{
+ const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *const args[] = {
+ progname,
+ "--force", "psmouse",
+ NULL,
+ };
+
+ test_spawn_prog(progname, args);
+ exit(EXIT_FAILURE);
+}
+static DEFINE_TEST(modprobe_force,
+ .description = "check modprobe --force",
+ .config = {
+ [TC_UNAME_R] = "4.4.4",
+ [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/force",
+ [TC_INIT_MODULE_RETCODES] = "",
+ },
+ .modules_loaded = "psmouse",
+ );
+
static const struct test *tests[] = {
&smodprobe_show_depends,
@@ -196,6 +218,7 @@ static const struct test *tests[] = {
&smodprobe_softdep_loop,
&smodprobe_install_cmd_loop,
&smodprobe_param_kcmdline,
+ &smodprobe_force,
NULL,
};
--
1.8.4.5

View File

@ -1,67 +0,0 @@
From 970b96f070b3f9ccd9c1850db44116a2b02da424 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 27 Feb 2014 23:31:33 +0100
Subject: [PATCH 06/10] testsuite: Do not provide finit_module(2) on older
kernels
If the test's uname -r is less that 3.8, return -ENOSYS from
finit_module(), so that the fallback is tested.
Patch-mainline: v17
Git-commit: 063086e038657de64f9980bc51954b0817fa8e6c
---
testsuite/init_module.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/testsuite/init_module.c b/testsuite/init_module.c
index 42177e7..269a471 100644
--- a/testsuite/init_module.c
+++ b/testsuite/init_module.c
@@ -37,6 +37,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/syscall.h>
+#include <sys/utsname.h>
#include <unistd.h>
/* kmod_elf_get_section() is not exported, we need the private header */
@@ -280,6 +281,25 @@ long init_module(void *mem, unsigned long len, const char *args)
return err;
}
+static int check_kernel_version(int major, int minor)
+{
+ struct utsname u;
+ const char *p;
+ int maj = 0, min = 0;
+
+ if (uname(&u) < 0)
+ return false;
+ for (p = u.release; *p >= '0' && *p <= '9'; p++)
+ maj = maj * 10 + *p - '0';
+ if (*p == '.')
+ for (p++; *p >= '0' && *p <= '9'; p++)
+ min = min * 10 + *p - '0';
+ if (maj > major || (maj == major && min >= minor))
+ return true;
+ return false;
+}
+
+
TS_EXPORT int finit_module(const int fd, const char *args, const int flags);
int finit_module(const int fd, const char *args, const int flags)
@@ -289,6 +309,10 @@ int finit_module(const int fd, const char *args, const int flags)
unsigned long len;
struct stat st;
+ if (!check_kernel_version(3, 8)) {
+ errno = ENOSYS;
+ return -1;
+ }
if (fstat(fd, &st) < 0)
return -1;
--
1.8.4.5

View File

@ -1,79 +0,0 @@
From 9a23dec3269fad1c4f03f6b9b4ceccedc136d4e2 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 27 Feb 2014 23:33:38 +0100
Subject: [PATCH 07/10] Add some tests for kernels without finit_module(2)
Patch-mainline: v17
Git-commit: be29c40e25b71d35708b9fad5772ebcd8e4685b3
[mmarek: Dropped binary files from the patch]
---
testsuite/test-modprobe.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index 92348b0..b675f48 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -209,6 +209,50 @@ static DEFINE_TEST(modprobe_force,
.modules_loaded = "psmouse",
);
+static noreturn int modprobe_oldkernel(const struct test *t)
+{
+ const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *const args[] = {
+ progname,
+ "psmouse",
+ NULL,
+ };
+
+ test_spawn_prog(progname, args);
+ exit(EXIT_FAILURE);
+}
+static DEFINE_TEST(modprobe_oldkernel,
+ .description = "check modprobe --force",
+ .config = {
+ [TC_UNAME_R] = "3.3.3",
+ [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/oldkernel",
+ [TC_INIT_MODULE_RETCODES] = "",
+ },
+ .modules_loaded = "psmouse",
+ );
+
+static noreturn int modprobe_oldkernel_force(const struct test *t)
+{
+ const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *const args[] = {
+ progname,
+ "--force", "psmouse",
+ NULL,
+ };
+
+ test_spawn_prog(progname, args);
+ exit(EXIT_FAILURE);
+}
+static DEFINE_TEST(modprobe_oldkernel_force,
+ .description = "check modprobe --force",
+ .config = {
+ [TC_UNAME_R] = "3.3.3",
+ [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/oldkernel-force",
+ [TC_INIT_MODULE_RETCODES] = "",
+ },
+ .modules_loaded = "psmouse",
+ );
+
static const struct test *tests[] = {
&smodprobe_show_depends,
@@ -219,6 +263,8 @@ static const struct test *tests[] = {
&smodprobe_install_cmd_loop,
&smodprobe_param_kcmdline,
&smodprobe_force,
+ &smodprobe_oldkernel,
+ &smodprobe_oldkernel_force,
NULL,
};
--
1.8.4.5

View File

@ -1,95 +0,0 @@
From 40926774b6153bfd7f0321b3226323958bc4d81d Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Thu, 27 Feb 2014 11:32:22 +0100
Subject: [PATCH 08/10] libkmod-module: Simplify kmod_module_insert_module()
Store the file and elf pointer in the kmod_module structure and have it
freed together with the module.
Patch-mainline: v17
Git-commit: c2f4d85a9adea895958fc85b9b87ce95a7dc7774
---
libkmod/libkmod-module.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 2f92e16..b94abd4 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -791,8 +791,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
int err;
const void *mem;
off_t size;
- struct kmod_file *file;
- struct kmod_elf *elf = NULL;
+ struct kmod_elf *elf;
const char *path;
const char *args = options ? options : "";
@@ -805,13 +804,13 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
return -ENOSYS;
}
- file = kmod_file_open(mod->ctx, path);
- if (file == NULL) {
+ mod->file = kmod_file_open(mod->ctx, path);
+ if (mod->file == NULL) {
err = -errno;
return err;
}
- if (kmod_file_get_direct(file)) {
+ if (kmod_file_get_direct(mod->file)) {
unsigned int kernel_flags = 0;
if (flags & KMOD_INSERT_FORCE_VERMAGIC)
@@ -819,19 +818,16 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
if (flags & KMOD_INSERT_FORCE_MODVERSION)
kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS;
- err = finit_module(kmod_file_get_fd(file), args, kernel_flags);
+ err = finit_module(kmod_file_get_fd(mod->file), args, kernel_flags);
if (err == 0 || errno != ENOSYS)
goto init_finished;
}
- size = kmod_file_get_size(file);
- mem = kmod_file_get_contents(file);
-
if (flags & (KMOD_INSERT_FORCE_VERMAGIC | KMOD_INSERT_FORCE_MODVERSION)) {
- elf = kmod_elf_new(mem, size);
+ elf = kmod_file_get_elf(mod->file);
if (elf == NULL) {
err = -errno;
- goto elf_failed;
+ return err;
}
if (flags & KMOD_INSERT_FORCE_MODVERSION) {
@@ -847,7 +843,10 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
}
mem = kmod_elf_get_memory(elf);
+ } else {
+ mem = kmod_file_get_contents(mod->file);
}
+ size = kmod_file_get_size(mod->file);
err = init_module(mem, size, args);
init_finished:
@@ -855,12 +854,6 @@ init_finished:
err = -errno;
INFO(mod->ctx, "Failed to insert module '%s': %m\n", path);
}
-
- if (elf != NULL)
- kmod_elf_unref(elf);
-elf_failed:
- kmod_file_unref(file);
-
return err;
}
--
1.8.4.5

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJSt12kAAoJEJuipaYwy+pT7LIQAJ1Yidwj1KUJJcBHu9u3R4er
8bIxU+NdblsKWOSU7kwoyhVg1O0TqGcVjX88cfgaYlamXMMdlRHMd4qLj8yW/X4B
8ktHoUfGWA4WmvMWWKce+dEjCdAknBv5Zkd1M7fMz1EMhM6qxbyhtAkuasUGUQYJ
0vz+TaldNYIiKmLB6xnOOx/vQzEdZQxAb78q8v7Vc9fYw/W8bs2QElBlSG2v+9Bk
N4VsiRGkrDv+1Fj5zfk+HwH/fl3R8YtzckBbg1dZGGGDyWgytK7ZeK8n3hZgGWD7
GHFbZIqX0timLq+aDW4tvtjBQeq6jCkXZghyxYd71kgTWwKYLRF22LOvlhJsowcA
lrbTkSkL1w3hdiDNZ2mJyK+sBtbPFj4Gslb4if9iWrePDkItgVT7mt989QHoEOl6
5UBqsgGpKl+c1iDfFtM5oOmmAbBUkCCjN2ubI67CtED70syFhKWPhedsqe8dkHit
tZMAvvnczsbvVnnqdUtAkpEkGF8Qm3gFdPQ2vFPN4SP7/MmU9rPHNUt5A3NfYFv7
beE7qj5GiTqMOfnN8zFojjCjoL6HlwI3NlBdVDLHHL3wlAyu0q4VfYMYykPvpsKJ
iX1ijwl03ObKGWhVhRbiWaMV7FoMAynCFEUsMb/OuFwAkbYSHG+JqkdyMVhJxHfQ
fOPUdvotkb+tIF++Ujux
=Ja4i
-----END PGP SIGNATURE-----

View File

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

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

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJTQb7hAAoJEJuipaYwy+pTGGUQAJK2Bfd3RtANK9+4s3AeXvGk
xCStqGHEjerf4ecDPMsSAUaNg6ADsGNPiQHDfg3y6wfp15+kmX+JoQPFWyghrIXf
6x/OMN3ilPM2cfqJayacDbtNwTaCOY0JLokLpI0nR5iItdi1u6D++FnAh2UDU3C6
SLOmsZeTYaUZDZwlte0ZERITxaTgAhjoxD7QiKk54KlwTBOK24JSLV/oxmMrUkkH
YB0JQ6vMuJEiHXFZLlJX+hmwElgw0dcB7H2ywVGugGhC+i1so/z1IRs98M1y/Shz
rL4YiRWdRpfeHofcfOt0vStfCIIbtavjcQkQczbo2KZHjUmbp+7BRrL1Jvidg2bd
op3CX8iZCq0BTipjQcEkJzZN2NuHgN8aswKhbxxUfS1tjD9tWhNblu95bu+xuf/c
lpKCHHp5q7kw15bWNgb8NrRaJesMl9yhId9Qx4GXpZ4vJDwN2yoew6Y6m+bPKq78
vyIOStrP63ku46+M7VhTjtnFMg/CELPFVzQLmVTmjG+Be4/UmpFZs54vh7UC784H
q6j4V944ZO3VGGw0VcS2d1eh2Q4XHO6aTZkUMP8mioADjAaEB0kgKsV1d7yHpH2n
XOQ8D9FYr1R1zE1E6f63pmdhHUTbXQRoieomQDW6BvQ5QqV2QG0HZ17o28g0H96L
AcKSiGnKIV8CkiELtR9x
=RcyU
-----END PGP SIGNATURE-----

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

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

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Tue Apr 8 08:36:22 UTC 2014 - mmarek@suse.cz
- Remove th now obsolete test-files.tar.xz tarball
(thanks to Jan Engelhardt)
-------------------------------------------------------------------
Mon Apr 7 19:07:17 UTC 2014 - mmarek@suse.com
- Updated to kmod 17
- Do not require xsltproc for build
- Parse softdeps stored in kernel modules
- Add experimental python bindings (not enabled in the package
yet)
- Misc bugfixes
- Deleted patches that went upstream. Only the unsupported modules
feature remains:
0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch
0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
0010-modprobe-Implement-allow-unsupported-modules.patch
-------------------------------------------------------------------
Tue Mar 11 13:38:23 UTC 2014 - mmarek@suse.cz

View File

@ -21,7 +21,7 @@ Name: kmod
Summary: Utilities to load modules into the kernel
License: LGPL-2.1+ and GPL-2.0+
Group: System/Kernel
Version: 16
Version: 17
Release: 0
Url: http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-module-init-tools/
#Announce: https://lwn.net/Articles/577962/
@ -30,28 +30,14 @@ Url: http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-modul
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/kmod/%name-%version.tar.xz
Source2: ftp://ftp.kernel.org/pub/linux/utils/kernel/kmod/%name-%version.tar.sign
# Files that would have been added by patches 5 and 7
Source3: test-files.tar.xz
Patch1: 0001-Remove-rmmod-w-documentation-and-getopt-entry.patch
Patch2: 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
Patch3: 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch
Patch4: 0004-testsuite-Check-the-list-of-loaded-modules-after-a-t.patch
Patch5: 0005-testsuite-Add-test-for-modprobe-force.patch
Patch6: 0006-testsuite-Do-not-provide-finit_module-2-on-older-ker.patch
Patch7: 0007-Add-some-tests-for-kernels-without-finit_module-2.patch
Patch8: 0008-libkmod-module-Simplify-kmod_module_insert_module.patch
Patch9: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch10: 0010-modprobe-Implement-allow-unsupported-modules.patch
Patch11: 0001-testsuite-Fix-uname-during-glibc-startup.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
%if 0%{?suse_version} >= 1220
BuildRequires: libxslt-tools
%else
BuildRequires: libxslt
%endif
BuildRequires: pkgconfig >= 0.21
BuildRequires: xz
%if 0%{?sles_version}
@ -112,19 +98,11 @@ in %lname.
%prep
%{?gpg_verify: xz -dk "%{S:0}"; %gpg_verify %{S:2}}
%setup -q -a 3
%patch1 -p1
touch man/rmmod.8
%setup -q
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build
autoreconf -fi
@ -174,7 +152,7 @@ mkdir -p "$b"/{bin,sbin,%_lib};
ln -s "%_bindir/kmod" "$b/bin/";
%if "%_libdir" != "/%_lib"
ln -s "%_libdir/libkmod.so.2" "$b/%_lib/";
ln -s "%_libdir/libkmod.so.2.2.6" "$b/%_lib/";
ln -s "%_libdir/libkmod.so.2.2.7" "$b/%_lib/";
%endif
%check

View File

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