SHA256
1
0
forked from pool/kmod

Accepting request 674337 from home:michals

- Enable PKCS#7 signature parsing again - requires openssl
- Fix testsuite build - requires kernel-default-devel
- Rediff the SUSE patches and rename starting with 0001.

- Update to new upstream release 26
  * depmod now handles parallel invocations better by protecting
    the temporary files being used.
  * modprobe has a new --show-exports option. Under the hood,
    this reads the .symtab and .strtab sections rather than
    __versions so it shows useful data even if kernel is
    configured without modversions (CONFIG_MODVERSIONS).
  * modinfo supports PKCS#7 parsing by using openssl.
- Replaced the asn1c-based parser by an openssl-based PKCS
  parser.
- Remove libkmod-signature-Fix-crash-when-module-signature-is.patch,
  libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch,
  libkmod-signature-implement-pkcs7-parsing-with-asn1c.patch
  (not accepted upstream)
- Remove enum.patch,
  depmod-Prevent-module-dependency-files-corruption-du.patch,
  depmod-Prevent-module-dependency-files-missing-durin.patch,
  depmod-shut-up-gcc-insufficinet-buffer-warning.patch
  (accepted upstream)

- Enable PKCS#7 signature parsing again - requires openssl
- Rediff the SUSE patches and rename starting with 0001.

OBS-URL: https://build.opensuse.org/request/show/674337
OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=158
This commit is contained in:
Jan Engelhardt 2019-02-12 23:23:22 +00:00 committed by Git OBS Bridge
parent 7ea344109a
commit 81cdb97d27
13 changed files with 131 additions and 289 deletions

View File

@ -1,7 +1,7 @@
From ae166d55534d92e12e4892431075539474c59918 Mon Sep 17 00:00:00 2001 From bbeef7f559bd9c6b1aad11bcd65e56428f290bd8 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz> From: Michal Marek <mmarek@suse.cz>
Date: Wed, 26 Feb 2014 13:48:55 +0100 Date: Wed, 26 Feb 2014 13:48:55 +0100
Subject: [PATCH 1/5] modprobe: Recognize --allow-unsupported-modules on Subject: [PATCH 1/6] modprobe: Recognize --allow-unsupported-modules on
commandline commandline
The option does not do anything yet, but it does not return error The option does not do anything yet, but it does not return error
@ -14,10 +14,10 @@ Patch-mainline: never
1 file changed, 5 insertions(+) 1 file changed, 5 insertions(+)
diff --git a/tools/modprobe.c b/tools/modprobe.c diff --git a/tools/modprobe.c b/tools/modprobe.c
index 6b34658..589cc07 100644 index a9e2331..3be2989 100644
--- a/tools/modprobe.c --- a/tools/modprobe.c
+++ b/tools/modprobe.c +++ b/tools/modprobe.c
@@ -83,6 +83,8 @@ static const struct option cmdopts[] = { @@ -85,6 +85,8 @@ static const struct option cmdopts[] = {
{"dirname", required_argument, 0, 'd'}, {"dirname", required_argument, 0, 'd'},
{"set-version", required_argument, 0, 'S'}, {"set-version", required_argument, 0, 'S'},
@ -26,7 +26,7 @@ index 6b34658..589cc07 100644
{"syslog", no_argument, 0, 's'}, {"syslog", no_argument, 0, 's'},
{"quiet", no_argument, 0, 'q'}, {"quiet", no_argument, 0, 'q'},
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'v'},
@@ -835,6 +837,9 @@ static int do_modprobe(int argc, char **orig_argv) @@ -843,6 +845,9 @@ static int do_modprobe(int argc, char **orig_argv)
case 'S': case 'S':
kversion = optarg; kversion = optarg;
break; break;
@ -37,5 +37,5 @@ index 6b34658..589cc07 100644
env_modprobe_options_append("-s"); env_modprobe_options_append("-s");
use_syslog = 1; use_syslog = 1;
-- --
1.8.4.5 2.20.1

View File

@ -1,7 +1,7 @@
From d607994c7b086afae09a8cded8bf6c5e8682541e Mon Sep 17 00:00:00 2001 From ede3e6010e5a132286c3a1ee815ec88bdef847b8 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz> From: Michal Marek <mmarek@suse.cz>
Date: Wed, 26 Feb 2014 13:53:38 +0100 Date: Wed, 26 Feb 2014 13:53:38 +0100
Subject: [PATCH 2/5] libkmod-config: Recognize allow_unsupported_modules in Subject: [PATCH 2/6] libkmod-config: Recognize allow_unsupported_modules in
the configuration the configuration
References: fate#316971 References: fate#316971
@ -11,10 +11,10 @@ Patch-mainline: never
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 0953924..79bfb9b 100644 index aaac0a1..1b24536 100644
--- a/libkmod/libkmod-config.c --- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c
@@ -667,6 +667,9 @@ static int kmod_config_parse(struct kmod_config *config, int fd, @@ -650,6 +650,9 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
|| streq(cmd, "config")) { || streq(cmd, "config")) {
ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n", ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n",
filename, cmd); filename, cmd);
@ -25,5 +25,5 @@ index 0953924..79bfb9b 100644
syntax_error: syntax_error:
ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n", ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n",
-- --
1.8.4.5 2.20.1

View File

@ -1,22 +1,22 @@
From 153da67042852b7667ce4479d14835450c908417 Mon Sep 17 00:00:00 2001 From 4a36f4a8b16c7fd345f6aec973d926d4e429328a Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz> From: Michal Marek <mmarek@suse.cz>
Date: Wed, 5 Mar 2014 14:40:14 +0100 Date: Wed, 5 Mar 2014 14:40:14 +0100
Subject: [PATCH 3/5] libkmod: Implement filtering of unsupported modules (off Subject: [PATCH 3/6] libkmod: Implement filtering of unsupported modules (off
by default) by default)
References: fate#316971 References: fate#316971
Patch-mainline: never Patch-mainline: never
--- ---
libkmod/libkmod-config.c | 12 ++++++++++-- libkmod/libkmod-config.c | 12 ++++++++++--
libkmod/libkmod-internal.h | 1 + libkmod/libkmod-internal.h | 1 +
libkmod/libkmod-module.c | 31 +++++++++++++++++++++++++++++++ libkmod/libkmod-module.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 2 deletions(-) 3 files changed, 42 insertions(+), 2 deletions(-)
Index: kmod-24/libkmod/libkmod-config.c diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
=================================================================== index 1b24536..07d6a9e 100644
--- kmod-24.orig/libkmod/libkmod-config.c --- a/libkmod/libkmod-config.c
+++ kmod-24/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c
@@ -651,8 +651,16 @@ static int kmod_config_parse(struct kmod @@ -651,8 +651,16 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n", ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n",
filename, cmd); filename, cmd);
} else if (streq(cmd, "allow_unsupported_modules")) { } else if (streq(cmd, "allow_unsupported_modules")) {
@ -35,10 +35,10 @@ Index: kmod-24/libkmod/libkmod-config.c
} else { } else {
syntax_error: syntax_error:
ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n", ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n",
Index: kmod-24/libkmod/libkmod-internal.h diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
=================================================================== index a65ddd1..2ad74c7 100644
--- kmod-24.orig/libkmod/libkmod-internal.h --- a/libkmod/libkmod-internal.h
+++ kmod-24/libkmod/libkmod-internal.h +++ b/libkmod/libkmod-internal.h
@@ -119,6 +119,7 @@ struct kmod_config { @@ -119,6 +119,7 @@ struct kmod_config {
struct kmod_list *softdeps; struct kmod_list *softdeps;
@ -47,11 +47,11 @@ Index: kmod-24/libkmod/libkmod-internal.h
}; };
int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **config, const char * const *config_paths) __attribute__((nonnull(1, 2,3))); int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **config, const char * const *config_paths) __attribute__((nonnull(1, 2,3)));
Index: kmod-24/libkmod/libkmod-module.c diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
=================================================================== index bffe715..9a3a35a 100644
--- kmod-24.orig/libkmod/libkmod-module.c --- a/libkmod/libkmod-module.c
+++ kmod-24/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c
@@ -798,6 +798,24 @@ KMOD_EXPORT int kmod_module_remove_modul @@ -798,6 +798,24 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod,
extern long init_module(const void *mem, unsigned long len, const char *args); extern long init_module(const void *mem, unsigned long len, const char *args);
@ -76,7 +76,7 @@ Index: kmod-24/libkmod/libkmod-module.c
/** /**
* kmod_module_insert_module: * kmod_module_insert_module:
* @mod: kmod module * @mod: kmod module
@@ -823,6 +841,7 @@ KMOD_EXPORT int kmod_module_insert_modul @@ -823,6 +841,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
struct kmod_elf *elf; struct kmod_elf *elf;
const char *path; const char *path;
const char *args = options ? options : ""; const char *args = options ? options : "";
@ -84,7 +84,7 @@ Index: kmod-24/libkmod/libkmod-module.c
if (mod == NULL) if (mod == NULL)
return -ENOENT; return -ENOENT;
@@ -841,6 +860,18 @@ KMOD_EXPORT int kmod_module_insert_modul @@ -841,6 +860,18 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
} }
} }
@ -103,3 +103,6 @@ Index: kmod-24/libkmod/libkmod-module.c
if (kmod_file_get_direct(mod->file)) { if (kmod_file_get_direct(mod->file)) {
unsigned int kernel_flags = 0; unsigned int kernel_flags = 0;
--
2.20.1

View File

@ -1,23 +1,23 @@
From 5ed5ab09ff7d4fb581aec3a35f2eff24eaa838f9 Mon Sep 17 00:00:00 2001 From 6cf25e17064cb213ef8c3a9c84ab787dd2852f2a Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz> From: Michal Marek <mmarek@suse.cz>
Date: Wed, 5 Mar 2014 15:02:44 +0100 Date: Wed, 5 Mar 2014 15:02:44 +0100
Subject: [PATCH] modprobe: Implement --allow-unsupported-modules Subject: [PATCH 4/6] modprobe: Implement --allow-unsupported-modules
References: fate#316971 References: fate#316971
Patch-mainline: never Patch-mainline: never
--- ---
Makefile.am | 4 +++- Makefile.am | 4 +++-
libkmod/libkmod-unsupported.c | 9 +++++++++ libkmod/libkmod-unsupported.c | 9 +++++++++
libkmod/libkmod-unsupported.h | 8 ++++++++ libkmod/libkmod-unsupported.h | 8 ++++++++
tools/modprobe.c | 8 +++++++- tools/modprobe.c | 8 +++++++-
4 files changed, 27 insertions(+), 2 deletions(-) 4 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 libkmod/libkmod-unsupported.c create mode 100644 libkmod/libkmod-unsupported.c
create mode 100644 libkmod/libkmod-unsupported.h create mode 100644 libkmod/libkmod-unsupported.h
Index: kmod-26/Makefile.am diff --git a/Makefile.am b/Makefile.am
=================================================================== index ddb25f0..e332977 100644
--- kmod-26.orig/Makefile.am --- a/Makefile.am
+++ kmod-26/Makefile.am +++ b/Makefile.am
@@ -92,7 +92,9 @@ libkmod_libkmod_la_LIBADD = \ @@ -92,7 +92,9 @@ libkmod_libkmod_la_LIBADD = \
${liblzma_LIBS} ${zlib_LIBS} ${openssl_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${openssl_LIBS}
@ -29,10 +29,11 @@ Index: kmod-26/Makefile.am
libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \ libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
-Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES) libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
Index: kmod-26/libkmod/libkmod-unsupported.c diff --git a/libkmod/libkmod-unsupported.c b/libkmod/libkmod-unsupported.c
=================================================================== new file mode 100644
index 0000000..7ef9fc8
--- /dev/null --- /dev/null
+++ kmod-26/libkmod/libkmod-unsupported.c +++ b/libkmod/libkmod-unsupported.c
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
+#include "libkmod-internal.h" +#include "libkmod-internal.h"
+#include "libkmod-unsupported.h" +#include "libkmod-unsupported.h"
@ -43,10 +44,11 @@ Index: kmod-26/libkmod/libkmod-unsupported.c
+ +
+ config->block_unsupported = 0; + config->block_unsupported = 0;
+} +}
Index: kmod-26/libkmod/libkmod-unsupported.h diff --git a/libkmod/libkmod-unsupported.h b/libkmod/libkmod-unsupported.h
=================================================================== new file mode 100644
index 0000000..a95b4a2
--- /dev/null --- /dev/null
+++ kmod-26/libkmod/libkmod-unsupported.h +++ b/libkmod/libkmod-unsupported.h
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
+#pragma once +#pragma once
+ +
@ -56,10 +58,10 @@ Index: kmod-26/libkmod/libkmod-unsupported.h
+ * library + * library
+ */ + */
+void kmod_internal_allow_unsupported(struct kmod_ctx *ctx); +void kmod_internal_allow_unsupported(struct kmod_ctx *ctx);
Index: kmod-26/tools/modprobe.c diff --git a/tools/modprobe.c b/tools/modprobe.c
=================================================================== index 3be2989..aa4033d 100644
--- kmod-26.orig/tools/modprobe.c --- a/tools/modprobe.c
+++ kmod-26/tools/modprobe.c +++ b/tools/modprobe.c
@@ -38,6 +38,8 @@ @@ -38,6 +38,8 @@
#include "kmod.h" #include "kmod.h"
@ -69,7 +71,7 @@ Index: kmod-26/tools/modprobe.c
static int log_priority = LOG_CRIT; static int log_priority = LOG_CRIT;
static int use_syslog = 0; static int use_syslog = 0;
#define LOG(...) log_printf(log_priority, __VA_ARGS__) #define LOG(...) log_printf(log_priority, __VA_ARGS__)
@@ -755,6 +757,7 @@ static int do_modprobe(int argc, char ** @@ -755,6 +757,7 @@ static int do_modprobe(int argc, char **orig_argv)
const char *dirname = NULL; const char *dirname = NULL;
const char *root = NULL; const char *root = NULL;
const char *kversion = NULL; const char *kversion = NULL;
@ -77,7 +79,7 @@ Index: kmod-26/tools/modprobe.c
int use_all = 0; int use_all = 0;
int do_remove = 0; int do_remove = 0;
int do_show_config = 0; int do_show_config = 0;
@@ -846,7 +849,7 @@ static int do_modprobe(int argc, char ** @@ -846,7 +849,7 @@ static int do_modprobe(int argc, char **orig_argv)
kversion = optarg; kversion = optarg;
break; break;
case 128: case 128:
@ -86,7 +88,7 @@ Index: kmod-26/tools/modprobe.c
break; break;
case 's': case 's':
env_modprobe_options_append("-s"); env_modprobe_options_append("-s");
@@ -919,6 +922,9 @@ static int do_modprobe(int argc, char ** @@ -919,6 +922,9 @@ static int do_modprobe(int argc, char **orig_argv)
log_setup_kmod_log(ctx, verbose); log_setup_kmod_log(ctx, verbose);
@ -96,3 +98,6 @@ Index: kmod-26/tools/modprobe.c
kmod_load_resources(ctx); kmod_load_resources(ctx);
if (do_show_config) if (do_show_config)
--
2.20.1

View File

@ -1,7 +1,7 @@
From be9bfe0f3724624d4b0240dbe6d580b7ae8b5256 Mon Sep 17 00:00:00 2001 From 9d2f7d1e372d79dfe732992effb33daf4ee56235 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz> From: Michal Marek <mmarek@suse.cz>
Date: Fri, 4 Apr 2014 10:08:01 +0200 Date: Fri, 4 Apr 2014 10:08:01 +0200
Subject: [PATCH 5/5] Do not filter unsupported modules when running a vanilla Subject: [PATCH 5/6] Do not filter unsupported modules when running a vanilla
kernel kernel
References: bnc#871066 References: bnc#871066
@ -11,13 +11,14 @@ Patch-mainline: never
1 file changed, 16 insertions(+), 3 deletions(-) 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 9f47cfd..9a486c4 100644 index 07d6a9e..550a612 100644
--- a/libkmod/libkmod-config.c --- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c
@@ -573,6 +573,18 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config) @@ -566,6 +566,18 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
return 0;
} }
/* +/*
+ * Check if kernel is built with the SUSE "suppported-flag" patch + * Check if kernel is built with the SUSE "suppported-flag" patch
+ */ + */
+static int is_suse_kernel(void) +static int is_suse_kernel(void)
@ -29,11 +30,10 @@ index 9f47cfd..9a486c4 100644
+ return 1; + return 1;
+} +}
+ +
+/* /*
* Take an fd and own it. It will be closed on return. filename is used only * Take an fd and own it. It will be closed on return. filename is used only
* for debug messages * for debug messages
*/ @@ -657,9 +669,10 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
@@ -674,9 +686,10 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
goto syntax_error; goto syntax_error;
if (streq(param, "yes") || streq(param, "1")) if (streq(param, "yes") || streq(param, "1"))
config->block_unsupported = 0; config->block_unsupported = 0;
@ -48,5 +48,5 @@ index 9f47cfd..9a486c4 100644
} else { } else {
syntax_error: syntax_error:
-- --
1.8.4.5 2.20.1

View File

@ -1,7 +1,7 @@
From 7e04a4a70e514aec5ed2328cb0a2d48bf6408197 Mon Sep 17 00:00:00 2001 From e48d1ee5980643f56165a9ee1687ff64f864aeb6 Mon Sep 17 00:00:00 2001
From: Vlad Bespalov <vlad.bespalov@jetstreamsoft.com> From: Vlad Bespalov <vlad.bespalov@jetstreamsoft.com>
Date: Fri, 8 Jun 2018 21:13:00 +0000 Date: Fri, 8 Jun 2018 21:13:00 +0000
Subject: [PATCH] modprobe: print status of "allow_unsupported_modules" Subject: [PATCH 6/6] modprobe: print status of "allow_unsupported_modules"
variable variable
In SLES11 modprobe printed everything referenced in /etc/modprobe.d In SLES11 modprobe printed everything referenced in /etc/modprobe.d
@ -43,7 +43,7 @@ index 550a612..0fc2250 100644
* kmod_config_get_blacklists: * kmod_config_get_blacklists:
* @ctx: kmod library context * @ctx: kmod library context
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index f9e33c6..0ae8ab3 100644 index 352627e..c2b9657 100644
--- a/libkmod/libkmod.h --- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h +++ b/libkmod/libkmod.h
@@ -115,6 +115,7 @@ const char *kmod_config_iter_get_key(const struct kmod_config_iter *iter); @@ -115,6 +115,7 @@ const char *kmod_config_iter_get_key(const struct kmod_config_iter *iter);
@ -55,10 +55,10 @@ index f9e33c6..0ae8ab3 100644
/* /*
* kmod_module * kmod_module
diff --git a/tools/modprobe.c b/tools/modprobe.c diff --git a/tools/modprobe.c b/tools/modprobe.c
index 1f6f286..8064e37 100644 index aa4033d..4f1c54a 100644
--- a/tools/modprobe.c --- a/tools/modprobe.c
+++ b/tools/modprobe.c +++ b/tools/modprobe.c
@@ -199,6 +199,11 @@ static int show_config(struct kmod_ctx *ctx) @@ -201,6 +201,11 @@ static int show_config(struct kmod_ctx *ctx)
kmod_config_iter_free_iter(iter); kmod_config_iter_free_iter(iter);
} }
@ -71,5 +71,5 @@ index 1f6f286..8064e37 100644
fflush(stdout); fflush(stdout);
-- --
2.12.3 2.20.1

View File

@ -1,62 +0,0 @@
From a06bacf500d56b72b5f9b121ebf7f6af9e3df185 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 17 Dec 2018 23:46:28 +0100
Subject: [PATCH] depmod: prevent module dependency files corruption due to
parallel invocation.
Depmod does not use unique filename for temporary files. There is no
guarantee the user does not attempt to run mutiple depmod processes in
parallel. If that happens a temporary file might be created by
depmod(1st), truncated by depmod(2nd), and renamed to final name by
depmod(1st) resulting in corrupted file seen by user.
Due to missing mkstempat() this is more complex than it should be.
Adding PID and timestamp to the filename should be reasonably reliable.
Adding O_EXCL as mkstemp does fails creating the file rather than
corrupting existing file.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
tools/depmod.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 18c0d61b2db3..0f7e33ccfd59 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/utsname.h>
#include <shared/array.h>
@@ -2398,6 +2399,9 @@ static int depmod_output(struct depmod *depmod, FILE *out)
};
const char *dname = depmod->cfg->dirname;
int dfd, err = 0;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
if (out != NULL)
dfd = -1;
@@ -2416,11 +2420,12 @@ static int depmod_output(struct depmod *depmod, FILE *out)
int r, ferr;
if (fp == NULL) {
- int flags = O_CREAT | O_TRUNC | O_WRONLY;
+ int flags = O_CREAT | O_EXCL | O_WRONLY;
int mode = 0644;
int fd;
- snprintf(tmp, sizeof(tmp), "%s.tmp", itr->name);
+ snprintf(tmp, sizeof(tmp), "%s.%i.%li.%li", itr->name, getpid(),
+ tv.tv_usec, tv.tv_sec);
fd = openat(dfd, tmp, flags, mode);
if (fd < 0) {
ERR("openat(%s, %s, %o, %o): %m\n",
--
2.19.2

View File

@ -1,33 +0,0 @@
From c2996b5fa880e81f63c25e80a4157b2239e32c5d Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 10 Dec 2018 22:29:32 +0100
Subject: [PATCH] depmod: prevent module dependency files missing during depmod
invocation
depmod deletes the module dependency files before moving the temporary
files in their place. This results in user seeing no dependency files
while they are updated. Remove the unlink call. The rename call should
suffice to move the new file in place and unlink the old one. It should
also do both atomically so there is no window when no dependency file
exists.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
tools/depmod.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 989d9077926c..18c0d61b2db3 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2451,7 +2451,6 @@ static int depmod_output(struct depmod *depmod, FILE *out)
break;
}
- unlinkat(dfd, itr->name, 0);
if (renameat(dfd, tmp, dfd, itr->name) != 0) {
err = -errno;
CRIT("renameat(%s, %s, %s, %s): %m\n",
--
2.19.2

View File

@ -1,112 +0,0 @@
From 4a894aeaebf69166e6344d8a82c2600a1d4c0d08 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 10 Dec 2018 22:29:34 +0100
Subject: [PATCH] depmod: shut up gcc insufficinet buffer warning
In a couple of places depmod concatenates the module directory and filename
with snprintf. This can technically overflow creating an unterminated string if
module directory name is long. Use openat instead as is done elsewhere in
depmod. This avoids the snprintf, the extra buffer on stack, and the gcc
warning. It may even fix a corner case when the module direcotry name is just
under PATH_MAX.
[ Lucas: fix up coding style and closing fd on error path ]
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
tools/depmod.c | 54 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 38 insertions(+), 16 deletions(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 0f7e33ccfd59..391afe9fe0a0 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -1389,19 +1389,45 @@ static int depmod_modules_build_array(struct depmod *depmod)
return 0;
}
+static FILE *dfdopen(const char *dname, const char *filename, int flags,
+ const char *mode)
+{
+ int fd, dfd;
+ FILE *ret;
+
+ dfd = open(dname, O_RDONLY);
+ if (dfd < 0) {
+ WRN("could not open directory %s: %m\n", dname);
+ return NULL;
+ }
+
+ fd = openat(dfd, filename, flags);
+ if (fd < 0) {
+ WRN("could not open %s at %s: %m\n", filename, dname);
+ ret = NULL;
+ } else {
+ ret = fdopen(fd, mode);
+ if (!ret) {
+ WRN("could not associate stream with %s: %m\n", filename);
+ close(fd);
+ }
+ }
+ close(dfd);
+ return ret;
+}
+
+
+
static void depmod_modules_sort(struct depmod *depmod)
{
- char order_file[PATH_MAX], line[PATH_MAX];
+ char line[PATH_MAX];
+ const char *order_file = "modules.order";
FILE *fp;
unsigned idx = 0, total = 0;
- snprintf(order_file, sizeof(order_file), "%s/modules.order",
- depmod->cfg->dirname);
- fp = fopen(order_file, "r");
- if (fp == NULL) {
- WRN("could not open %s: %m\n", order_file);
+ fp = dfdopen(depmod->cfg->dirname, order_file, O_RDONLY, "r");
+ if (fp == NULL)
return;
- }
while (fgets(line, sizeof(line), fp) != NULL) {
size_t len = strlen(line);
@@ -1409,8 +1435,8 @@ static void depmod_modules_sort(struct depmod *depmod)
if (len == 0)
continue;
if (line[len - 1] != '\n') {
- ERR("%s:%u corrupted line misses '\\n'\n",
- order_file, idx);
+ ERR("%s/%s:%u corrupted line misses '\\n'\n",
+ depmod->cfg->dirname, order_file, idx);
goto corrupted;
}
}
@@ -2287,18 +2313,14 @@ static int output_builtin_bin(struct depmod *depmod, FILE *out)
{
FILE *in;
struct index_node *idx;
- char infile[PATH_MAX], line[PATH_MAX], modname[PATH_MAX];
+ char line[PATH_MAX], modname[PATH_MAX];
if (out == stdout)
return 0;
- snprintf(infile, sizeof(infile), "%s/modules.builtin",
- depmod->cfg->dirname);
- in = fopen(infile, "r");
- if (in == NULL) {
- WRN("could not open %s: %m\n", infile);
+ in = dfdopen(depmod->cfg->dirname, "modules.builtin", O_RDONLY, "r");
+ if (in == NULL)
return 0;
- }
idx = index_create();
if (idx == NULL) {
--
2.19.2

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Tue Feb 12 19:41:20 UTC 2019 - Michal Suchanek <msuchanek@suse.com>
- Enable PKCS#7 signature parsing again - requires openssl
- Fix testsuite build - requires kernel-default-devel
- Rediff the SUSE patches and rename starting with 0001.
-------------------------------------------------------------------
Fri Feb 8 00:31:29 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Update to new upstream release 26
* depmod now handles parallel invocations better by protecting
the temporary files being used.
* modprobe has a new --show-exports option. Under the hood,
this reads the .symtab and .strtab sections rather than
__versions so it shows useful data even if kernel is
configured without modversions (CONFIG_MODVERSIONS).
* modinfo supports PKCS#7 parsing by using openssl.
- Replaced the asn1c-based parser by an openssl-based PKCS
parser.
- Remove libkmod-signature-Fix-crash-when-module-signature-is.patch,
libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch,
libkmod-signature-implement-pkcs7-parsing-with-asn1c.patch
(not accepted upstream)
- Remove enum.patch,
depmod-Prevent-module-dependency-files-corruption-du.patch,
depmod-Prevent-module-dependency-files-missing-durin.patch,
depmod-shut-up-gcc-insufficinet-buffer-warning.patch
(accepted upstream)
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Dec 7 14:55:21 UTC 2018 - Michal Suchanek <msuchanek@suse.de> Fri Dec 7 14:55:21 UTC 2018 - Michal Suchanek <msuchanek@suse.de>

View File

@ -29,15 +29,17 @@ URL: https://www.kernel.org/pub/linux/utils/kernel/kmod/
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod #Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz
Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign
Patch1: 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch Patch1: 0001-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
Patch2: 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch Patch2: 0002-libkmod-config-Recognize-allow_unsupported_modules-i.patch
Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch Patch3: 0003-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch Patch4: 0004-modprobe-Implement-allow-unsupported-modules.patch
Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch Patch5: 0005-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch8: 0012-modprobe-print-unsupported-status.patch Patch6: 0006-modprobe-print-status-of-allow_unsupported_modules-v.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: kernel-default-devel
BuildRequires: libopenssl-devel >= 1.1.0
BuildRequires: libtool BuildRequires: libtool
BuildRequires: pkgconfig >= 0.21 BuildRequires: pkgconfig >= 0.21
BuildRequires: xz BuildRequires: xz
@ -66,6 +68,7 @@ export LDFLAGS="-Wl,-z,relro,-z,now"
%configure \ %configure \
--with-xz \ --with-xz \
--with-zlib \ --with-zlib \
--with-openssl \
--includedir="%_includedir/kmod" \ --includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \ --with-rootlibdir="%_libdir" \
--bindir="%_bindir" --bindir="%_bindir"

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Feb 12 19:41:20 UTC 2019 - Michal Suchanek <msuchanek@suse.com>
- Enable PKCS#7 signature parsing again - requires openssl
- Rediff the SUSE patches and rename starting with 0001.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 8 00:31:29 UTC 2019 - Jan Engelhardt <jengelh@inai.de> Fri Feb 8 00:31:29 UTC 2019 - Jan Engelhardt <jengelh@inai.de>

View File

@ -29,15 +29,16 @@ URL: https://www.kernel.org/pub/linux/utils/kernel/kmod/
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod #Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz
Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign
Patch1: 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch Patch1: 0001-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
Patch2: 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch Patch2: 0002-libkmod-config-Recognize-allow_unsupported_modules-i.patch
Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch Patch3: 0003-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch Patch4: 0004-modprobe-Implement-allow-unsupported-modules.patch
Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch Patch5: 0005-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch8: 0012-modprobe-print-unsupported-status.patch Patch6: 0006-modprobe-print-status-of-allow_unsupported_modules-v.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: libopenssl-devel >= 1.1.0
BuildRequires: libtool BuildRequires: libtool
BuildRequires: pkgconfig >= 0.21 BuildRequires: pkgconfig >= 0.21
BuildRequires: xz BuildRequires: xz
@ -114,6 +115,7 @@ export LDFLAGS="-Wl,-z,relro,-z,now"
%configure \ %configure \
--with-xz \ --with-xz \
--with-zlib \ --with-zlib \
--with-openssl \
--includedir="%_includedir/kmod" \ --includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \ --with-rootlibdir="%_libdir" \
--bindir="%_bindir" --bindir="%_bindir"