Tarsnap / tarsnap

Command-line client code for Tarsnap.
https://tarsnap.com
Other
865 stars 60 forks source link

tests/valgrind: pthread_atfork() leak in FreeBSD 12.2 #507

Closed gperciva closed 2 years ago

gperciva commented 2 years ago

I discovered this due to LibreSSL's arc4random4.c and arc4random_freebsd.h, but it's not their fault at all.

I don't think this matters a great deal. POSIX notes:

The pthread_atfork() function may be formally deprecated (for
example, by shading it OB) in a future version of this standard.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html

while LibreSSL's arc4random_freebsd.h notes:

/*
 * Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10) if
 * a program does not link to -lthr. Callbacks registered with pthread_atfork()
 * appear to fail silently. So, it is not always possible to detect a PID
 * wraparound.
 */

Still, it would be nice to clear up the valgrind warnings about the 40 bytes of "still rechable" memory.

gperciva commented 2 years ago

Revised to only compile&run on FreeBSD.