Control: retitle -1 perl crashes with use Net::DNS and use threads
Control: reassign -1 libnet-dns-perl 1.58-1
Control: affects -1 src:gdnsd
On Wed, Nov 25, 2026 at 01:03:40PM +0000, Santiago Vila wrote:
> During a rebuild of all packages in unstable, this package failed to build.
>
> [...]
>
> Test Summary Report
> -------------------
> ./029tcp_dso/058dso.t (Wstat: 6 (Signal: ABRT) Tests: 41
> Failed: 0)
> Non-zero wait status: 6
Stripping down this particular test incrementally, I got to this minimal
reproducer, that is not gdnsd specific at all:
$ cat 029tcp_dso/058dso.t
use strict;
use warnings;
use threads;
use Net::DNS::Packet; # <- "use Net::DNS::Resolver" <- "use Net::DNS"
my $client_close_ka = async { };
$client_close_ka->join();
$ perl 029tcp_dso/058dso.t
free(): double free detected in tcache 2
Aborted (core dumped) perl 029tcp_dso/058dso.t
This is new, triggered by the recent libnet-dns-perl 1.58-1 upload, and
is not reproducible with 1.57-1.
A gdb backtrace reveals:
[...]
#6 malloc_printerr (str=str@entry=0x7f4c58c867b8 "free(): double free detected
in tcache 2") at ./malloc/malloc.c:5346
#7 0x00007f4c58b7a59b in tcache_double_free_verify (e=<optimized out>) at
./malloc/malloc.c:3156
#8 0x00007f4c58a169a3 in ?? () from
/usr/lib/x86_64-linux-gnu/perl/5.44/auto/Digest/SHA/SHA.so
#9 0x000055a882b065c0 in ?? ()
#10 0x000055a882b92ac6 in Perl_runops_standard ()
#11 0x000055a882a5e9d1 in Perl_call_sv ()
#12 0x000055a882b986cc in ?? ()
[...]
I think this has to do with this line in Net/DNS/Packet.pm, which was
seemingly introduced in 1.58:
my $hash = HASH ? Digest::SHA->new(256) : undef;
Interestingly, an even more minimal reproducer is this:
perl -MDigest::SHA -Mthreads -e 'my $sha = Digest::SHA->new(256); async
{}->join'
I could not find a documented thread-safety warning in Digest::SHA (a
core perl-modules module), but I also didn't spend much time researching
that. Crashing with a double-free sounds like a core Perl bug
nevertheless though? OTOH I can reproduce it in much older versions of
Perl (I tested as low as 5.28), so perhaps it's not a very common
problem.
TL;DR: Net::DNS 1.58 is now thread-unsafe due to its use of
Digest::SHA->new, causing Perl to SIGABRT. The gdnsd test suite is using
threads and Net::DNS (a reasonable expectation) and crashes, and thus
FTBFS.
Regards,
Faidon