SHA256
1
0
forked from pool/kmod

Accepting request 659763 from home:michals

Fix changelog: mention all patches. Refesh to upstream patch.
  * Add depmod-Prevent-module-dependency-files-corruption-du.patch
  * Add depmod-Prevent-module-dependency-files-missing-durin.patch
  * Add depmod-shut-up-gcc-insufficinet-buffer-warning.patch
  * Add depmod-Prevent-module-dependency-files-corruption-du.patch
  * Add depmod-Prevent-module-dependency-files-missing-durin.patch
  * Add depmod-shut-up-gcc-insufficinet-buffer-warning.patch

OBS-URL: https://build.opensuse.org/request/show/659763
OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=154
This commit is contained in:
Jan Engelhardt 2018-12-18 22:55:28 +00:00 committed by Git OBS Bridge
parent 38e2a9611a
commit e6f1948011
7 changed files with 46 additions and 43 deletions

View File

@ -1,7 +1,7 @@
From ff3140310a52ba86af67b3676f542e11e1451bdc Mon Sep 17 00:00:00 2001
From a06bacf500d56b72b5f9b121ebf7f6af9e3df185 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 7 Dec 2018 15:45:41 +0100
Subject: [PATCH] depmod: Prevent module dependency files corruption due to
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
@ -17,11 +17,11 @@ corrupting existing file.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
tools/depmod.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
tools/depmod.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 18c0d61b2db3..3b6d16e76160 100644
index 18c0d61b2db3..0f7e33ccfd59 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -29,6 +29,7 @@
@ -42,24 +42,18 @@ index 18c0d61b2db3..3b6d16e76160 100644
if (out != NULL)
dfd = -1;
@@ -2412,15 +2416,17 @@ static int depmod_output(struct depmod *depmod, FILE *out)
for (itr = depfiles; itr->name != NULL; itr++) {
FILE *fp = out;
- char tmp[NAME_MAX] = "";
+ char tmp[NAME_MAX + 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_TRUNC | O_WRONLY | O_EXCL;
+ 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);
+ tmp[NAME_MAX] = 0;
fd = openat(dfd, tmp, flags, mode);
if (fd < 0) {
ERR("openat(%s, %s, %o, %o): %m\n",

View File

@ -1,15 +1,15 @@
From 3a48513ff3b5ab0b19696bc4c0fabb351bd62afb Mon Sep 17 00:00:00 2001
From c2996b5fa880e81f63c25e80a4157b2239e32c5d Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 10 Dec 2018 15:30:07 +0100
Subject: [PATCH] depmod: Prevent module dependency files missing during depmod
invocation.
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
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 newa file in place and remove unlink the old one. It
should also do both atomically so there is no window whn no dependency
file exists.
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>
---

View File

@ -1,7 +1,7 @@
From af9a6e3754b6fa4e5cefb70aa6621b2f52ca94f1 Mon Sep 17 00:00:00 2001
From 4a894aeaebf69166e6344d8a82c2600a1d4c0d08 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 10 Dec 2018 16:36:03 +0100
Subject: [PATCH] depmod: shut up gcc insufficinet buffer warning.
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
@ -10,25 +10,28 @@ 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 | 51 ++++++++++++++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 16 deletions(-)
tools/depmod.c | 54 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 38 insertions(+), 16 deletions(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 3b6d16e76160..6fca30a2f3e2 100644
index 0f7e33ccfd59..391afe9fe0a0 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -1389,19 +1389,42 @@ static int depmod_modules_build_array(struct depmod *depmod)
@@ -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)
+ {
+static FILE *dfdopen(const char *dname, const char *filename, int flags,
+ const char *mode)
+{
+ int fd, dfd;
+ FILE * ret;
+ FILE *ret;
+
+ dfd = open(dname, flags);
+ dfd = open(dname, O_RDONLY);
+ if (dfd < 0) {
+ WRN("could not open directory %s: %m\n", dname);
+ return NULL;
@ -40,8 +43,10 @@ index 3b6d16e76160..6fca30a2f3e2 100644
+ ret = NULL;
+ } else {
+ ret = fdopen(fd, mode);
+ if (!ret)
+ if (!ret) {
+ WRN("could not associate stream with %s: %m\n", filename);
+ close(fd);
+ }
+ }
+ close(dfd);
+ return ret;
@ -53,7 +58,7 @@ index 3b6d16e76160..6fca30a2f3e2 100644
{
- char order_file[PATH_MAX], line[PATH_MAX];
+ char line[PATH_MAX];
+ const char * order_file = "modules.order";
+ const char *order_file = "modules.order";
FILE *fp;
unsigned idx = 0, total = 0;
@ -69,7 +74,7 @@ index 3b6d16e76160..6fca30a2f3e2 100644
while (fgets(line, sizeof(line), fp) != NULL) {
size_t len = strlen(line);
@@ -1409,8 +1432,8 @@ static void depmod_modules_sort(struct depmod *depmod)
@@ -1409,8 +1435,8 @@ static void depmod_modules_sort(struct depmod *depmod)
if (len == 0)
continue;
if (line[len - 1] != '\n') {
@ -80,7 +85,7 @@ index 3b6d16e76160..6fca30a2f3e2 100644
goto corrupted;
}
}
@@ -2287,18 +2310,14 @@ static int output_builtin_bin(struct depmod *depmod, FILE *out)
@@ -2287,18 +2313,14 @@ static int output_builtin_bin(struct depmod *depmod, FILE *out)
{
FILE *in;
struct index_node *idx;

View File

@ -2,7 +2,9 @@
Fri Dec 7 14:55:21 UTC 2018 - Michal Suchanek <msuchanek@suse.de>
- Fix module dependency file corruption on parallel invocation (bsc#1118629).
Add depmod-Prevent-module-dependency-files-corruption-due-to-pa.patch
* Add depmod-Prevent-module-dependency-files-corruption-du.patch
* Add depmod-Prevent-module-dependency-files-missing-durin.patch
* Add depmod-shut-up-gcc-insufficinet-buffer-warning.patch
-------------------------------------------------------------------
Wed Jul 18 08:51:06 UTC 2018 - jengelh@inai.de

View File

@ -41,8 +41,8 @@ Patch7: libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch
Patch8: 0012-modprobe-print-unsupported-status.patch
Patch9: enum.patch
Patch10: depmod-Prevent-module-dependency-files-missing-durin.patch
Patch11: depmod-shut-up-gcc-insufficinet-buffer-warning.patch
Patch12: depmod-Prevent-module-dependency-files-corruption-du.patch
Patch11: depmod-Prevent-module-dependency-files-corruption-du.patch
Patch12: depmod-shut-up-gcc-insufficinet-buffer-warning.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: asn1c
BuildRequires: autoconf

View File

@ -2,7 +2,9 @@
Fri Dec 7 14:55:21 UTC 2018 - Michal Suchanek <msuchanek@suse.de>
- Fix module dependency file corruption on parallel invocation (bsc#1118629).
Add depmod-Prevent-module-dependency-files-corruption-due-to-pa.patch
* Add depmod-Prevent-module-dependency-files-corruption-du.patch
* Add depmod-Prevent-module-dependency-files-missing-durin.patch
* Add depmod-shut-up-gcc-insufficinet-buffer-warning.patch
-------------------------------------------------------------------
Wed Jul 18 08:51:06 UTC 2018 - jengelh@inai.de

View File

@ -40,8 +40,8 @@ Patch7: libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch
Patch8: 0012-modprobe-print-unsupported-status.patch
Patch9: enum.patch
Patch10: depmod-Prevent-module-dependency-files-missing-durin.patch
Patch11: depmod-shut-up-gcc-insufficinet-buffer-warning.patch
Patch12: depmod-Prevent-module-dependency-files-corruption-du.patch
Patch11: depmod-Prevent-module-dependency-files-corruption-du.patch
Patch12: depmod-shut-up-gcc-insufficinet-buffer-warning.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: asn1c
BuildRequires: autoconf