!11 fix rngd.service coredump
From: @yang_zhuang_zhuang Reviewed-by: @overweight,@small_leek Signed-off-by: @overweight,@small_leek
This commit is contained in:
commit
e986bb35d0
@ -0,0 +1,34 @@
|
||||
From d2b4876231ac9c2e26880ebe428bfb41e60e098e Mon Sep 17 00:00:00 2001
|
||||
From: Neil Horman <nhorman@tuxdriver.com>
|
||||
Date: Wed, 19 Dec 2018 10:10:44 -0500
|
||||
Subject: [PATCH] Default to one thread if getaffinity returns an error
|
||||
|
||||
Its possible on virt systems, for sched_getaffinity to return an error
|
||||
if the vm has cpus, but cgroup placement restricts that set to 0
|
||||
physical processors. In that event, just default to 1 thread on cpu 0
|
||||
|
||||
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
|
||||
---
|
||||
rngd_jitter.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rngd_jitter.c b/rngd_jitter.c
|
||||
index 4e4b348..d14a3ba 100644
|
||||
--- a/rngd_jitter.c
|
||||
+++ b/rngd_jitter.c
|
||||
@@ -421,7 +421,11 @@ int init_jitter_entropy_source(struct rng *ent_src)
|
||||
cpus = CPU_ALLOC(i);
|
||||
cpusize = CPU_ALLOC_SIZE(i);
|
||||
CPU_ZERO_S(cpusize, cpus);
|
||||
- sched_getaffinity(0, cpusize, cpus);
|
||||
+ if (sched_getaffinity(0, cpusize, cpus) < 0) {
|
||||
+ message(LOG_DAEMON|LOG_DEBUG, "Can not determine affinity of process, defaulting to 1 thread\n");
|
||||
+ CPU_SET(0,cpus);
|
||||
+ }
|
||||
+
|
||||
num_threads = CPU_COUNT_S(cpusize, cpus);
|
||||
|
||||
if (num_threads >= ent_src->rng_options[JITTER_OPT_THREADS].int_val)
|
||||
--
|
||||
2.17.2
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: rng-tools
|
||||
Version: 6.5
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Random number generator daemon
|
||||
License: GPLv2+
|
||||
URL: https://github.com/nhorman/rng-tools
|
||||
@ -9,6 +9,7 @@ Source1: rngd.service
|
||||
Source2: jitterentropy-library-2.2.0.tar.gz
|
||||
|
||||
Patch0: jitterentropy-remove-install.patch
|
||||
Patch1: backport-Default-to-one-thread-if-getaffinity-returns-an-erro.patch
|
||||
|
||||
#Dependency
|
||||
BuildRequires: gcc make gettext systemd autoconf automake
|
||||
@ -59,6 +60,9 @@ install -D -t $RPM_BUILD_ROOT%{_unitdir} -m 0644 %{SOURCE1}
|
||||
%{_mandir}/man8/rngd.8.*
|
||||
|
||||
%changelog
|
||||
* Thu Dec 10 2020 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 6.5-2
|
||||
- fix rngd.service coredump
|
||||
|
||||
* Wed Sep 2 2020 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 6.5-1
|
||||
- since 6.6, jitterentropy-library is independed from rng-tools,
|
||||
no any entropy source will lead to rng-tools service fail.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user