Package: haveged
Version: 1.9.14
Severity: normal
Tags: patch

Apparently since the introduction of "command mode" (option "-c"),
haveged was no longer usable as an independent user application for
generating high-quality random numbers.

For no apparent reason, only one instance of the application was allowed
to run, and so it could not be run as a user application while a haveged
daemon (or even just another instance of the user application) was
running at the same time.

The provided patch checks whether the program is being run as a normal
user application for directly delivering random numbers and ignores
other instances in this case.

I have also created an upstream bug report

https://github.com/jirka-h/haveged/issues/66#issue-1043382947

for this problem.
Without this patch, the application tries to create the command
socket, even when running as a regular user application for
harvesting entropy independent of any daemon.

This will fail if another instance of haveged is already running,
no matter whether that other instance is a daemon or not.

This patch will make the application ignore the socket when run
as a regular user application, thus avoiding the problem.

(Patch created 2021-11-03 by Guenther Brunthaler.)

Index: haveged-1.9.14/src/haveged.c
===================================================================
--- haveged-1.9.14.orig/src/haveged.c
+++ haveged-1.9.14/src/haveged.c
@@ -429,7 +429,7 @@ int main(int argc, char **argv)
       close(socket_fd);
       return ret;
       }
-   else {
+   else if (!(params->setup & RUN_AS_APP)){
       socket_fd = cmd_listen(params);
       if (socket_fd >= 0)
          fprintf(stderr, "%s: command socket is listening at fd %d\n", params->daemon, socket_fd);

Reply via email to