[Dnsmasq-discuss] Crash with "double free or corruption" when receiving SIGHUP, on a configuration using hosts file and tags
Mathieu ABATI
m.abati at trusted-objects.com
Fri Jan 31 13:20:04 UTC 2025
Hi,
I am using dnsmasq through libvirt, and I get a crash when I send SIGHUP to dnsmasq, my setup is using a configuration with hosts and options files including tags.
No error in my configuration files is reported by dnsmasq.
I attached some files to have a simple setup to reproduce the issue.
1. Prepare network interfaces by running setup.sh script, it creates bridged virtual interfaces to simulate DHCP server and client.
2. Run dnsmasq: sudo dnsmasq -d --conf-file=dnsmasq.conf
3. Simulate a DHCP request from the host present in hosts.conf (else the crash will not occur): sudo dhclient -v -d dhclient-test
4. Send SIGHUP to dnsmasq to trigger hosts and options files reload. You get a crash with "double free or corruption (out)" message.
5. Cleanup with cleanup.sh script.
If you edit hosts.conf to remove the ",set:group1" part, no more crash doing the same operations.
So it seems to be related on tags reload in hosts file.
Reproduced on ArchLinux and Ubuntu using dnsmasq 2.90.
As a workaround to this problem, I removed tags from hosts.conf file and I have added such entry in the main configuration file:
dhcp-mac=set:group1,52:54:00:3b:e8:08
This is not reloaded on SIGHUP, but this is acceptable in my use case where I only need to update static IP addresses and options.
But indeed it doesn't allow to dynamically add new tagged hosts without restarting dnsmasq process.
Best regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup.sh
Type: application/x-shellscript
Size: 553 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20250131/555d6b2d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cleanup.sh
Type: application/x-shellscript
Size: 211 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20250131/555d6b2d/attachment-0001.bin>
-------------- next part --------------
strict-order
except-interface=lo
bind-dynamic
leasefile-ro
interface=dnsmasq-test
dhcp-range=192.168.126.2,192.168.126.254,255.255.255.0
dhcp-no-override
dhcp-authoritative
dhcp-lease-max=253
dhcp-hostsfile=hosts.conf
dhcp-optsfile=options.conf
-------------- next part --------------
tag:group1,option:dns-server,8.8.8.8,8.8.4.4
-------------- next part --------------
52:54:00:3b:e8:08,set:group1,192.168.126.2
More information about the Dnsmasq-discuss
mailing list