Hello community,
here is the log from the commit of package module-init-tools for openSUSE:Factory
checked in at Sat Jul 4 13:35:36 CEST 2009.
--------
--- module-init-tools/module-init-tools.changes 2009-06-08 18:22:14.000000000 +0200
+++ /mounts/work_src_done/STABLE/module-init-tools/module-init-tools.changes 2009-07-03 12:47:56.000000000 +0200
@@ -1,0 +2,19 @@
+Fri Jul 3 11:06:09 CEST 2009 - mmarek@suse.cz
+
+- Updated to git master (351e438)
+ * option handling cleanup and fixes
+ * depmod -e -E Module.symvers checks also symbol versions
+- weak-updates2:
+ * make use of depmod -e -E instead of the hack that used to be
+ there (fixes bnc#467902 properly).
+ * only look for messages about missing / different symbols
+ (bnc#485914).
+- commit e255776
+
+-------------------------------------------------------------------
+Fri Jul 3 11:04:57 CEST 2009 - mmarek@suse.cz
+
+- start maintaining the package in a branch of an upstream git clone
+- commit aa9c242
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
mit-unsupported-modules.patch
mit-zlibsupport-use-mmap.patch
modprobe.conf.tar.gz
modprobe-different-exit-codes.patch
package-manpages.sh
New:
----
modprobe.conf.tar.bz2
module-init-tools-manpages.diff
module-init-tools-suse.diff
module-init-tools-upstream.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ module-init-tools.spec ++++++
--- /var/tmp/diff_new_pack.c16306/_old 2009-07-04 13:35:02.000000000 +0200
+++ /var/tmp/diff_new_pack.c16306/_new 2009-07-04 13:35:02.000000000 +0200
@@ -21,7 +21,7 @@
Name: module-init-tools
BuildRequires: zlib-devel
Version: 3.9
-Release: 1
+Release: 2
License: GPL v2 or later
Group: System/Kernel
# for grepping /etc/SUSE-release
@@ -39,19 +39,15 @@
Summary: Utilities to Load Modules into the Kernel
Url: http://www.kerneltools.org/
Source0: http://www.kernel.org/pub/linux/kernel/people/jcm/module-init-tools/module-i...
-Source2: package-manpages.sh
-Source4: README.SUSE
-Source6: modprobe.conf.tar.gz
-Source7: depmod-00-system.conf
-Source8: 10-unsupported-modules.conf
-Source9: weak-modules
-Source10: weak-modules2
-# upstream patches
-# (none)
-# suse patches
-Patch11: mit-zlibsupport-use-mmap.patch
-Patch12: modprobe-different-exit-codes.patch
-Patch13: mit-unsupported-modules.patch
+Source1: README.SUSE
+Source2: modprobe.conf.tar.bz2
+Source3: depmod-00-system.conf
+Source4: 10-unsupported-modules.conf
+Source5: weak-modules
+Source6: weak-modules2
+Patch1: module-init-tools-upstream.diff
+Patch2: module-init-tools-suse.diff
+Patch3: module-init-tools-manpages.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -71,10 +67,10 @@
Jon Masters
%prep
-%setup -q -a6
-%patch11
-%patch12
-%patch13
+%setup -q -a2
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
autoreconf --force --install
++++++ module-init-tools-manpages.diff ++++++
This patch updates the generated manpages to avoid dependency on docbook2man
diff -ru -x doc a/modprobe.8 b/modprobe.8
--- a/modprobe.8
+++ b/modprobe.8
@@ -229,6 +229,15 @@
\fB-d --dirname \fR
Directory where modules can be found, \fI/lib/modules/RELEASE\fR
by default.
+.TP
+\fB--allow-unsupported-modules \fR
+Load unsupported modules even if disabled in configuration.
+.SH "RETURN VALUE"
+.PP
+\fBmodprobe\fR returns 0 on success, 1 on an unspecified
+error and 2 if the module is not supported. Use the
+\fB--allow-unsupported-modules\fR option to force
+using an unsupported module.
.SH "ENVIRONMENT"
.PP
The MODPROBE_OPTIONS environment variable can also be used to
diff -ru -x doc a/modprobe.conf.5 b/modprobe.conf.5
--- a/modprobe.conf.5
+++ b/modprobe.conf.5
@@ -113,6 +113,13 @@
invalidly claims to support a device: the
\fBblacklist\fR keyword indicates that all of
that particular module's internal aliases are to be ignored.
+.TP
+\fBallow_unsupported_modules \fI[0|1]\fB \fR
+In SUSE kernels, every kernel module has a flag 'supported'. If
+this flag is not set loading this module will taint your kernel.
+Setting this option to 0 disables loading of unsupported modules
+and avoids tainting the kernel. This is typically set in
+\fI/etc/modprobe.d/unsupported-modules\fR\&.
.SH "COPYRIGHT"
.PP
This manual page Copyright 2004, Rusty Russell, IBM Corporation.
++++++ module-init-tools-suse.diff ++++++
This patch contains suse-specific changes against upstream commit 351e4381cb67aea9ef6ab03a8655b7a8aebe2ad8
diff --git a/depmod.c b/depmod.c
index 4c8caa0..c683811 100644
--- a/depmod.c
+++ b/depmod.c
@@ -193,7 +193,7 @@ static void load_module_symvers(const char *filename)
/* eg. "0xb352177e\tfind_first_bit\tvmlinux\tEXPORT_SYMBOL" */
while (fgets(line, sizeof(line)-1, module_symvers)) {
- const char *ver, *sym, *where;
+ const char *ver, *sym, *where, *slash;
ver = strtok(line, " \t");
sym = strtok(NULL, " \t");
@@ -201,7 +201,9 @@ static void load_module_symvers(const char *filename)
if (!ver || !sym || !where)
continue;
- if (streq(where, "vmlinux"))
+ if (streq(where, "vmlinux") ||
+ (((slash = strrchr(where, '/'))) &&
+ streq(slash, "/built-in")))
add_symbol(sym, strtoull(ver, NULL, 16), NULL);
}
diff --git a/doc/modprobe.conf.sgml b/doc/modprobe.conf.sgml
index cacc006..cd94511 100644
--- a/doc/modprobe.conf.sgml
+++ b/doc/modprobe.conf.sgml
@@ -176,6 +176,19 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>allow_unsupported_modules <replaceable>[0|1]</replaceable>
+ </term>
+ <listitem>
+ <para>
+ In SUSE kernels, every kernel module has a flag 'supported'. If
+ this flag is not set loading this module will taint your kernel.
+ Setting this option to 0 disables loading of unsupported modules
+ and avoids tainting the kernel. This is typically set in
+ <filename>/etc/modprobe.d/unsupported-modules</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<refsect1>
diff --git a/doc/modprobe.sgml b/doc/modprobe.sgml
index fde8ca7..01ee9e1 100644
--- a/doc/modprobe.sgml
+++ b/doc/modprobe.sgml
@@ -430,9 +430,28 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--allow-unsupported-modules</option>
+ </term>
+ <listitem>
+ <para>
+ Load unsupported modules even if disabled in configuration.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<refsect1>
+ <title>RETURN VALUE</title>
+
+ <para>
+ <command>modprobe</command> returns 0 on success, 1 on an unspecified
+ error and 2 if the module is not supported. Use the
+ <option>--allow-unsupported-modules</option> option to force
+ using an unsupported module.
+ </para>
+ </refsect1>
+ <refsect1>
<title>ENVIRONMENT</title>
<para>
The MODPROBE_OPTIONS environment variable can also be used to
diff --git a/logging.c b/logging.c
index 4330269..46257ff 100644
--- a/logging.c
+++ b/logging.c
@@ -57,13 +57,15 @@ void error(const char *fmt, ...)
va_end(arglist);
}
+/* can be overriden for different kinds of errors */
+int fatal_exit_code = 1;
void fatal(const char *fmt, ...)
{
va_list arglist;
va_start(arglist, fmt);
message("FATAL: ", fmt, &arglist);
va_end(arglist);
- exit(1);
+ exit(fatal_exit_code);
}
/* If we don't flush, then child processes print before we do */
diff --git a/logging.h b/logging.h
index c01187b..7445ab4 100644
--- a/logging.h
+++ b/logging.h
@@ -10,6 +10,9 @@ extern int quiet;
/* Do we want informative messages as well as errors? */
extern int verbose;
+/* Exit code returned by fatal() */
+extern int fatal_exit_code;
+
extern void fatal(const char *fmt, ...);
extern void error(const char *fmt, ...);
extern void warn(const char *fmt, ...);
diff --git a/modprobe.c b/modprobe.c
index 21a3111..648192d 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -51,6 +51,9 @@
int use_binary_indexes = 1; /* default to enabled. */
+/* Allow loading of unsupported modules? */
+static int allow_unsupported = 1;
+
extern long init_module(void *, unsigned long, const char *);
extern long delete_module(const char *, unsigned int);
@@ -69,8 +72,9 @@ typedef enum
mit_ignore_commands = 16,
mit_ignore_loaded = 32,
mit_strip_vermagic = 64,
- mit_strip_modversion = 128
+ mit_strip_modversion = 128,
+ mit_force_allow_unsupported = 1<<20,
} modprobe_flags_t;
#ifndef MODULE_DIR
@@ -354,6 +358,23 @@ static void clear_magic(struct elf_file *module)
}
}
+static int module_supported(struct elf_file *module)
+{
+ struct string_table *tbl;
+ int j;
+
+ /* Grab from new-style .modinfo section. */
+ tbl = module->ops->load_strings(module, ".modinfo", NULL, fatal);
+ for (j = 0; tbl && j < tbl->cnt; j++) {
+ const char *p = tbl->str[j];
+ if (streq(p, "supported=yes") ||
+ streq(p, "supported=external")) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
struct module_options
{
struct module_options *next;
@@ -787,6 +808,16 @@ static int parse_config_file(const char *filename,
if (streq(tmp, "no"))
use_binary_indexes = 0;
}
+ } else if (strcmp(cmd, "allow_unsupported_modules") == 0) {
+ const char *option = strsep_skipspace(&ptr, "\t ");
+ if (!option)
+ grammar(cmd, filename, linenum);
+ else if (streq(option, "yes") || streq(option, "1"))
+ allow_unsupported = 1;
+ else if (streq(option, "no") || streq(option, "0"))
+ allow_unsupported = 0;
+ else
+ grammar(cmd, filename, linenum);
} else
grammar(cmd, filename, linenum);
@@ -1144,6 +1175,17 @@ static int insmod(struct list_head *list,
strerror(errno));
goto out_unlock;
}
+ /* Supported? */
+ if (!allow_unsupported && !module_supported(module)) {
+ if (error == fatal)
+ fatal_exit_code = 2;
+ error("module '%s' is unsupported\n"
+ "Use --allow-unsupported or set allow_unsupported_modules to 1 in\n"
+ "/etc/modprobe.d/10-unsupported-modules.conf\n",
+ mod->filename);
+ goto out;
+ }
+
if (newname)
rename_module(module, mod->modname, newname);
if (flags & mit_strip_modversion)
@@ -1309,6 +1351,16 @@ int do_modprobe(char *modname,
/* Returns the resolved alias, options */
parse_toplevel_config(configname, modname, 0,
flags & mit_remove, &modoptions, &commands, &aliases, &blacklist);
+ if (flags & mit_force_allow_unsupported)
+ allow_unsupported = 1;
+ /* Be nice to people running non-suse kernels and allow
+ * unsupported modules */
+ if (!allow_unsupported) {
+ if (access("/proc/sys/kernel/", F_OK) == 0 &&
+ access("/proc/sys/kernel/unsupported", F_OK) == -1 &&
+ errno == ENOENT)
+ allow_unsupported = 1;
+ }
/* Read module options from kernel command line */
parse_kcmdline(0, &modoptions);
@@ -1390,6 +1442,8 @@ static struct option options[] = { { "version", 0, NULL, 'V' },
{ "force-modversion", 0, NULL, 2 },
{ "first-time", 0, NULL, 3 },
{ "dump-modversions", 0, NULL, 4 },
+ { "allow-unsupported-modules", 0, NULL, 128 },
+ { "use-blacklist", 0, NULL, 'b' },
{ NULL, 0, NULL, 0 } };
int main(int argc, char *argv[])
@@ -1494,6 +1548,9 @@ int main(int argc, char *argv[])
case 4:
dump_modver = 1;
break;
+ case 128:
+ flags |= mit_force_allow_unsupported;
+ break;
default:
print_usage(argv[0]);
}
diff --git a/zlibsupport.c b/zlibsupport.c
index b159765..0f78524 100644
--- a/zlibsupport.c
+++ b/zlibsupport.c
@@ -12,6 +12,8 @@
#include
#include
#include
+#include
+#include
#include "zlibsupport.h"
#include "logging.h"
@@ -19,69 +21,35 @@
#ifdef CONFIG_USE_ZLIB
#include
+#endif
-void *grab_contents(gzFile *gzfd, unsigned long *size)
+#ifdef CONFIG_USE_ZLIB
+static int check_gz_magic(int fd)
{
- unsigned int max = 16384;
- void *buffer = NOFAIL(malloc(max));
- int ret;
-
- *size = 0;
- while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
- *size += ret;
- if (*size == max)
- buffer = NOFAIL(realloc(buffer, max *= 2));
- }
- if (ret < 0) {
- free(buffer);
- buffer = NULL;
- }
-
- return buffer;
+ unsigned char magic[2];
+
+ if (read(fd, magic, 2) != 2)
+ return -1;
+ lseek(fd, 0, SEEK_SET);
+ if (magic[0] == 0x1f && magic[1] == 0x8b)
+ return 1;
+ return 0;
}
-void *grab_fd(int fd, unsigned long *size)
+static char *tmpdir(void)
{
- gzFile gzfd;
-
- gzfd = gzdopen(fd, "rb");
- if (!gzfd) {
- if (errno == ENOMEM)
- fatal("Memory allocation failure in gzdopen\n");
- return NULL;
- }
-
- /* gzclose(gzfd) would close fd, which would drop locks.
- Don't blame zlib: POSIX locking semantics are so horribly
- broken that they should be ripped out. */
- return grab_contents(gzfd, size);
+ static char *TMPDIR;
+
+ if (TMPDIR)
+ return TMPDIR;
+ TMPDIR = getenv("TMPDIR");
+ if (!TMPDIR)
+ TMPDIR = "/tmp";
+ return TMPDIR;
}
+#endif
-/* gzopen handles uncompressed files transparently. */
-void *grab_file(const char *filename, unsigned long *size)
-{
- gzFile gzfd;
- void *buffer;
-
- errno = 0;
- gzfd = gzopen(filename, "rb");
- if (!gzfd) {
- if (errno == ENOMEM)
- fatal("Memory allocation failure in gzopen\n");
- return NULL;
- }
- buffer = grab_contents(gzfd, size);
- gzclose(gzfd);
- return buffer;
-}
-
-void release_file(void *data, unsigned long size)
-{
- free(data);
-}
-#else /* ... !CONFIG_USE_ZLIB */
-
-void *grab_fd(int fd, unsigned long *size)
+void *do_grab_fd(int fd, unsigned long *size)
{
struct stat st;
void *map;
@@ -97,6 +65,60 @@ void *grab_fd(int fd, unsigned long *size)
return map;
}
+void *grab_fd(int fd, unsigned long *size)
+{
+#ifdef CONFIG_USE_ZLIB
+ int magic = check_gz_magic(fd);
+ if (magic == -1)
+ return NULL;
+ if (magic) {
+ gzFile gzfd;
+ int tmp;
+ char buffer[4096];
+ char *template;
+ int r, w;
+ void *ret = NULL;
+
+ template = NOFAIL(malloc(strlen(tmpdir()) + sizeof("/m-i-t.XXXXXX")));
+ sprintf(template, "%s/m-i-t.XXXXXX", tmpdir());
+ gzfd = gzdopen(dup(fd), "rb");
+ if (!gzfd) {
+ if (errno == ENOMEM)
+ fatal("Memory allocation failure in gzdopen\n");
+ goto out_template;
+ }
+ tmp = mkstemp(template);
+ if (tmp == -1)
+ goto out_template;
+
+ while ((r = gzread(gzfd, buffer, sizeof(buffer))) > 0) {
+ char *p = buffer;
+ do {
+ w = write(tmp, p, r);
+ if (w > 0) {
+ r -= w;
+ p += w;
+ }
+ } while (w > 0 || (w == -1 && errno == EINTR));
+ if (w == -1)
+ goto out;
+ }
+ if (r < 0)
+ goto out;
+ gzclose(gzfd);
+ ret = do_grab_fd(tmp, size);
+out:
+ close(tmp);
+ unlink(template);
+out_template:
+ free(template);
+ return ret;
+ } else
+#endif
+ return do_grab_fd(fd, size);
+}
+
+
void *grab_file(const char *filename, unsigned long *size)
{
int fd;
@@ -114,4 +136,4 @@ void release_file(void *data, unsigned long size)
{
munmap(data, size);
}
-#endif
+
++++++ module-init-tools-upstream.diff ++++++
++++ 2689 lines (skipped)
++++++ weak-modules2 ++++++
--- /var/tmp/diff_new_pack.c16306/_old 2009-07-04 13:35:03.000000000 +0200
+++ /var/tmp/diff_new_pack.c16306/_new 2009-07-04 13:35:03.000000000 +0200
@@ -104,98 +104,32 @@
)"
}
-# Compute the kernel release of a module.
-krel_of_module() {
- declare module=$1
- set -- $(/sbin/modinfo -F vermagic "$module")
- echo "$1"
-}
-
-NM=
-if command -v nm >/dev/null; then
- NM=nm
-elif command -v eu-nm >/dev/null; then
- NM=eu-nm
-else
- echo "ERROR: nm not found" >&2
- exit 1
-fi
-
-# Check if MODULE is compatible with kernel release KREL.
-module_is_compatible() {
- local module=$1 krel=$2 basedir=$3
- local module_krel=$(krel_of_module "$module")
-
- # Symbols exported by the kernel itself
- if [ ! -e $tmpdir/symvers-$krel ]; then
- if [ -e /boot/symvers-$krel.gz ]; then
- zcat /boot/symvers-$krel.gz \
- | sed -r -ne 's:^0x0*([0-9a-f]+\t[0-9a-zA-Z_]+)\t.*:\1:p'
- fi > $tmpdir/symvers-$krel
- fi
-
- # Symbols exported by KMPs
- for dir in $basedir/lib/modules/$krel/{updates,extra,weak-updates}; do
- test -d "$dir" || continue
- find "$dir" -name '*.ko' | while read f; do
- test "$f" -ef "$module" && continue
- $NM -B "$f"
- done | sed -nre 's:^0*([0-9a-f]+) A __crc_(.*):\1 \2:p'
- done > $tmpdir/extra-symvers
-
- sort -u $tmpdir/symvers-$krel $tmpdir/extra-symvers > $tmpdir/all-symvers
-
- # If the module does not have modversions enabled, $tmpdir/modvers
- # will be empty.
- /sbin/modprobe --dump-modversions "$module" \
- | sed -r -e 's:^0x0*([0-9a-f]+\t.*):\1:' \
- | sort -u \
- > $tmpdir/modvers
-
- # Only include lines of the second file in the output that don't
- # match lines in the first file. (The default separator is
- # <space>, so we are matching the whole line.)
- join -j 1 -v 2 $tmpdir/all-symvers $tmpdir/modvers > $tmpdir/join
-
- if [ ! -s $tmpdir/modvers ]; then
- echo "Warning: Module ${module##*/} from kernel $module_krel has no" \
- "modversions, so it cannot be reused for kernel $krel" >&2
- elif [ -s $tmpdir/join ]; then
- [ -n "$verbose" ] &&
- echo "Module ${module##*/} from kernel $module_krel is not compatible" \
- "with kernel $krel in symbols:" $(sed -e 's:.* ::' $tmpdir/join)
- elif [ "$krel" != "$module_krel" ]; then
- [ -n "$verbose" ] &&
- echo "Module ${module##*/} from kernel $module_krel is compatible" \
- "with kernel $krel"
- return 0
- fi
- return 1
-}
-
# Check for unresolved symbols
has_unresolved_symbols() {
- local krel=$1 basedir=$2 output status
+ local krel=$1 basedir=$2 output status args sym_errors
- output="$(/sbin/depmod -b "$basedir" -F /boot/System.map-$krel \
- -ae $krel 2>&1)"
- status=$?
- if [ -n "$output" ]; then
- status=1
- [ -z "$opt_debug" ] || echo "$output"
+ if [ ! -e $tmpdir/symvers-$krel -a -e /boot/symvers-$krel.gz ]; then
+ zcat /boot/symvers-$krel.gz > $tmpdir/symvers-$krel
+ fi
+ if [ -e $tmpdir/symvers-$krel ]; then
+ args=(-E $tmpdir/symvers-$krel)
+ else
+ echo "warning: $tmpdir/symvers-$krel not available" >&2
+ args=(-F /boot/System.map-$krel)
fi
+ output="$(/sbin/depmod -b "$basedir" -ae "${args[@]}" $krel 2>&1)"
+ status=$?
if [ $status -ne 0 ]; then
+ echo "$output" >&2
+ echo "depmod exited with error $status" >&2
+ return 0
+ fi
+ sym_errors=$(echo "$output" | \
+ grep -E ' (needs unknown|disagrees about version of) symbol ')
+ if [ -n "$sym_errors" ]; then
+ [ -z "$opt_debug" ] || echo "$sym_errors" >&2
return 0
fi
-
- # HACK HACK HACK - depmod doesn't check symbol _versions_, so check
- # modules in weak-updates the old way (nm and symvers files)
- # The proper fix is to teach depmod about modversions of course
- while read module; do
- if ! module_is_compatible "$module" "$krel" "$basedir"; then
- return 0
- fi
- done < <(find "$basedir/lib/modules/$krel/weak-updates" -name '*.ko')
return 1
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org