[Dnsmasq-discuss] Crash with "double free or corruption" when receiving SIGHUP, on a configuration using hosts file and tags

Geert Stappers stappers at stappers.nl
Fri Jan 31 14:22:38 UTC 2025


On Fri, Jan 31, 2025 at 02:20:04PM +0100, Mathieu ABATI wrote:
> 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.

Please reproduce with dnsmasq 2.91test9 and after that,
reproduce with the patch from Brain Haley from 2025-01-23.
 

> 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



> 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

> tag:group1,option:dns-server,8.8.8.8,8.8.4.4

> 52:54:00:3b:e8:08,set:group1,192.168.126.2



Groeten
Geert Stappers
-- 
Silence is hard to parse



More information about the Dnsmasq-discuss mailing list