| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Rather than rounding bits down, round them up. Otherwise 249 bits full
in a 256 bit pool won't ever get filled up with the additional 7 bits.
In addition, target a full pool rather than a half pool, since a full
pool is sometimes required.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- fixes uclibc-ng compile (does not provide sys/auxv.h header file)
Fixes:
haveged.c:22:10: fatal error: sys/auxv.h: No such file or directory
22 | #include <sys/auxv.h>
| ^~~~~~~~~~~~
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
for closing the communication socket. As well as get
error messages back from running instance to client process.
Signed-off-by: Werner Fink <werner@suse.de>
|
| |
|
|
|
|
|
|
| |
We won't have access to change the watermark if we're running in
an unprivileged container, so if the error is EACCES just warn
and continue
|
| |
|
|
|
|
| |
Because the parameter is `long int` type.
|
| |
|
|
|
|
| |
This was the compiler warning: "warning: ISO C forbids empty initializer braces"
|
|
|
|
| |
http://www.gnu.org/software/libc/manual/html_node/Other-Output-Conversions.html
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
don't use SOCK_CLOEXEC or SOCK_NONBLOCK if not available
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Avoids these errors:
havegecmd.c: In function ‘cmd_listen’:
havegecmd.c:105: error: ‘SOCK_CLOEXEC’ undeclared (first use in this function)
havegecmd.c:105: error: (Each undeclared identifier is reported only once
havegecmd.c:105: error: for each function it appears in.)
havegecmd.c:105: error: ‘SOCK_NONBLOCK’ undeclared (first use in this function)
havegecmd.c: In function ‘cmd_connect’:
havegecmd.c:154: error: ‘SOCK_CLOEXEC’ undeclared (first use in this function)
havegecmd.c:154: error: ‘SOCK_NONBLOCK’ undeclared (first use in this function)
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bug happens when havege is built with --enable-threads.
On shutdown the following crash happens:
```
3109 p = mem2chunk (mem);
(gdb) bt
#0 __GI___libc_free (mem=0x7f630c066000) at malloc.c:3109
#1 0x00007f630c035f9e in havege_destroy (hptr=0x564b56b6b900) at havege.c:197
#2 0x0000564b561c3dca in error_exit (format=<optimized out>) at haveged.c:708
#3 0x0000564b561c33f1 in run_daemon (argv=0x7ffce7627758, path=0x564b56b6b2a0
```
valgrind helped me to understand it was a mmap() / free()
mismatch:
```
For lists of detected and suppressed errors, rerun with: -s
ERROR SUMMARY: 14 errors from 2 contexts (suppressed: 0 from 0)
Invalid free() / delete / delete[] / realloc()
at 0x48389CB: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x48AED9F: havege_destroy (havege.c:197)
by 0x10BCA5: error_exit (haveged.c:708)
by 0x10B1B7: run_daemon (haveged.c:573)
by 0x10B1B7: main (haveged.c:470)
Address 0x4845000 is in a rw- anonymous segment
```
It happens due to a few factors:
1. havege is built in threaded mode, there parent pid is stored in shared
memory and is expected to free resources.
2. havege is ran in daemon mode, that means havege changes pid when detaches
from terminal with daemon().
Combination of [1.] and [2.] causes main process to avoid munmap()
and inctead fallback to free() at:
```c
void havege_destroy(H_PTR hptr)
{
...
if (!havege_exit(hptr)) // <- here incorrect pid-based detection happens
return;
if (0 != (temp=hptr->io_buf)) {
hptr->io_buf = 0;
free(temp); // <--- here free() happens
}
```
The change adds a helper to update parent pid with `havege_reparent` helper.
It might not be a very clean fix, but it should be good enough to illustrate
the problem.
Bug: https://bugs.gentoo.org/720286
Reported-by: Marcin Mirosław
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Previously failed with:
havegetune.c:190:12: error: ‘BUILD_THREAD’ undeclared (first use in this function); did you mean ‘BUILD_THREADS’?
190 | *bp++ = BUILD_THREAD;
| ^~~~~~~~~~~~
| BUILD_THREADS
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
fix segv at start
|
| | |
|
| | |
|
| | |
|