<div dir="ltr"><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div>Hello everyone,</div></div><div>I found a core dump issue when I use dnsmasq as a DHCP server (Version 2.86, running on Linux). My setup and reproduction step is as follows.</div><div>Dnsmasq main config</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># Common Configure<br>pid-file=/var/run/dnsmasq.pid<br>log-facility=/var/log/dnsmasq.log<br>user=root<br>group=root<br>interface=eth0<br><br># DNS Server Configure<br>no-hosts<br>no-resolv<br>log-queries=extra<br>port=53<br><br># DHCP Server Configure<br>log-dhcp<br>dhcp-range=172.17.12.128,static,255.255.255.192 # Change the network address and subnet mask.<br>dhcp-hostsfile=/etc/dnsmasq/dhcp-hosts<br>dhcp-optsfile=/etc/dnsmasq/dhcp-options<br>dhcp-vendorclass=set:pxe-bios-x86,PXEClient:Arch:00000<br>dhcp-vendorclass=set:pxe-uefi-amd64,PXEClient:Arch:00007<br>dhcp-vendorclass=set:pxe-uefi-amd64,PXEClient:Arch:00009<br>dhcp-boot=tag:pxe-bios-x86,pxelinux.0,pxeserver<br>dhcp-boot=tag:pxe-uefi-amd64,bootnetx64.efi,pxeserver<br>dhcp-ignore=tag:!known<br></blockquote><div>External DHCP host file</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">08:c0:eb:cb:MM:NN,id:*,set:mytag,172.17.12.XXX,XXX-01,5m </blockquote><div>External DHCP options file</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">tag:mytag,option:netmask,255.255.255.128<br>tag:mytag,option:router,172.17.12.190<br>tag:mytag,option:dns-server,172.16.0.XXX<br>tag:mytag,option:ntp-server,172.16.0.XXX<br>tag:mytag,option:domain-name,mydomain<br></blockquote><div>Reproduction step is <br></div><div>First start dnsmasq with the config shown above, </div><div>Then use 08:c0:eb:cb:MM:NN to obtain an IP address from dnsmasq server.</div><div>After we can see lease of 08:c0:eb:cb:MM:NN in dnsmasq.leases, send signal HUP to dnsmasq,</div><div>Now I got dnsmasq core dumped and traceback is following</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50<br>#1  0x00007f858837f535 in __GI_abort () at abort.c:79<br>#2  0x00007f85883d6518 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7f85884e028d "%s\n")<br>    at ../sysdeps/posix/libc_fatal.c:181<br>#3  0x00007f85883dcc3a in malloc_printerr (str=str@entry=0x7f85884e1fe0 "double free or corruption (out)") at malloc.c:5359<br>#4  0x00007f85883de770 in _int_free (av=0x7f8588517c40 <main_arena>, p=0x7ffd7d6e79a0, have_lock=<optimized out>) at malloc.c:4321<br>#5  0x0000000000410187 in dhcp_netid_free (nid=0x7ffd7d6e79b0) at option.c:1019<br>#6  0x0000000000410258 in dhcp_netid_list_free (netid=0x0) at option.c:1050<br>#7  0x00000000004102c9 in dhcp_config_free (config=0x2273950) at option.c:1068<br>#8  0x000000000041c313 in clear_dynamic_conf () at option.c:5186<br>#9  0x000000000041c3bd in reread_dhcp () at option.c:5219<br>#10 0x0000000000428a11 in clear_cache_and_reload (now=1650633404) at dnsmasq.c:1694<br>#11 0x0000000000428303 in async_event (pipe=10, now=1650633404) at dnsmasq.c:1450<br>#12 0x0000000000427cf4 in main (argc=3, argv=0x7ffd7d6e81a8) at dnsmasq.c:1193<br></blockquote><div>It looks like there is some memory management issue about dhcp tag</div><div>I found another related fact that if I just start dnsmasq and reload it, or dnsmasq only receive dhcp packet from UNKNOWN mac address and reload it, dnsmasq will NOT core dumped when reloading, so I guess that the issue maybe related to progress of DHCP packet</div><div>That is all about I found about core dumped issue when reloading, I'm looking forward for someone found similar problem or have idea about this issue</div><div><br></div><div>Thanks</div><div>Han Bing</div></div></div></div>