Resolves: bz 1690364

This commit is contained in:
Neil Horman 2019-05-24 05:59:26 -04:00 committed by nhorman
parent 9a9f6e6737
commit ee4a52cb98
2 changed files with 40 additions and 0 deletions

View File

@ -10,6 +10,8 @@ URL: https://github.com/nhorman/rng-tools
Source0: https://github.com/nhorman/rng-tools/archive/rng-tools-%{version}.tar.gz
Source1: rngd.service
Patch0: rngd-shutdown.patch
# https://sourceforge.net/p/gkernel/patches/111/
BuildRequires: gcc make
@ -68,6 +70,9 @@ install -Dt %{buildroot}%{_unitdir} -m0644 %{SOURCE1}
%attr(0644,root,root) %{_unitdir}/rngd.service
%changelog
* Fri May 24 2019 Neil Horman <nhorman@redhat.com> -6.7-2
- Fix race in shutdown leading to hang (bz 1690364)
* Thu Feb 14 2019 Neil Horman <nhorman@redhat.com> - 6.7-1
- Update to latest upstream

35
rngd-shutdown.patch Normal file
View File

@ -0,0 +1,35 @@
diff --git a/rngd_jitter.c b/rngd_jitter.c
index 23d96b3..43a13e0 100644
--- a/rngd_jitter.c
+++ b/rngd_jitter.c
@@ -473,26 +473,22 @@ void close_jitter_entropy_source(struct rng *ent_src)
for (i=0; i < num_threads; i++)
tdata[i].active = 0;
- flags = fcntl(pipefds[1], F_GETFL, 0);
- flags |= O_NONBLOCK;
- fcntl(pipefds[1], F_SETFL, &flags);
+ close(pipefds[1]);
/* And wait for completion of each thread */
for (i=0; i < num_threads; i++) {
message(LOG_DAEMON|LOG_DEBUG, "Checking on done for thread %d\n", i);
while (!tdata[i].done)
+ pthread_kill(threads[i], SIGINT);
if(tdata[i].done) {
message(LOG_DAEMON|LOG_INFO, "Closing thread %d\n", tdata[i].core_id);
pthread_join(threads[i], NULL);
jent_entropy_collector_free(tdata[i].ec);
- } else {
- read(pipefds[0], tmpbuf, 1024);
+ } else
sched_yield();
- }
}
- close(pipefds[2]);
- close(pipefds[1]);
+ close(pipefds[0]);
free(tdata);
free(threads);
return;