jobcore/kmod/0001-master.patch
2022-07-01 00:23:59 +03:00

97 lines
3.2 KiB
Diff

From 16c086f48c2270ad6412ad7226df53079f825270 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Thu, 30 Jun 2022 18:47:25 +0200
Subject: [PATCH 1/3] testsuite: repair read of uninitialized memory
Function ``test_backoff_time`` does not initialize ``delta``, and
``get_backoff_delta_msec`` then performs a read from uninitialized
memory with the ``!*delta`` expression.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
---
testsuite/test-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/test-util.c b/testsuite/test-util.c
index fb8c9ef..5766584 100644
--- a/testsuite/test-util.c
+++ b/testsuite/test-util.c
@@ -231,7 +231,7 @@ DEFINE_TEST(test_addu64_overflow,
static int test_backoff_time(const struct test *t)
{
- unsigned long long delta;
+ unsigned long long delta = 0;
/* Check exponential increments */
get_backoff_delta_msec(now_msec(), now_msec() + 10, &delta);
From 09ad8605520c87e799cb89e2bcdf2f36e21f77ba Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Date: Thu, 24 Jun 2021 14:53:56 +0100
Subject: [PATCH 2/3] build: enable building & running tests from a subdir
During dpkg build, in a subdir, it is currently not possible to run
tests. Building testsuite/modules due to non-existance of the
testsuite directory under the build dir. Thus create it, when it is
not there.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.am b/Makefile.am
index 0e48770..b0a654c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -255,6 +255,7 @@ CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) &
build-module-playground:
$(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
$(RM) -rf testsuite/module-playground && \
+ mkdir -p testsuite/ && \
cp -r $(top_srcdir)/$(MODULE_PLAYGROUND) $(top_builddir)/$(MODULE_PLAYGROUND) && \
find $(top_builddir)/$(MODULE_PLAYGROUND) -type d -exec chmod +w {} \; ; \
fi
From c1fb98a30dae051ab69d23624d1e062d0527527e Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Fri, 19 Nov 2021 18:33:49 +0000
Subject: [PATCH 3/3] modprobe: Write error messages to syslog if stderr is
unavailable
The man page modprobe(8) states for the --syslog option:
"This is also automatically enabled when stderr is unavailable."
but it wasn't happening.
This commit now makes modprobe write to syslog if stderr is closed.
---
tools/modprobe.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 2a2ae21..3240c2b 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -819,6 +819,7 @@ static int do_modprobe(int argc, char **orig_argv)
int do_show_modversions = 0;
int do_show_exports = 0;
int err;
+ struct stat stat_buf;
argv = prepend_options_from_env(&argc, orig_argv);
if (argv == NULL) {
@@ -947,6 +948,12 @@ static int do_modprobe(int argc, char **orig_argv)
args = argv + optind;
nargs = argc - optind;
+ if (!use_syslog &&
+ (!stderr ||
+ fileno(stderr) == -1 ||
+ fstat(fileno(stderr), &stat_buf)))
+ use_syslog = 1;
+
log_open(use_syslog);
if (!do_show_config) {