Opened 2 years ago

Last modified 2 years ago

#20469 new defect

ujail or dnsmasq segfault with second instance on different port

Reported by: openwrt@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: Cc:


Attempting to create a second instance of dnsmasq with a -C /etc/dnsmasq2.conf and /var/run/dnmasq/, --no-resolv, --leasefile-ro --dhcp-script=/bin/true, dropping /tmp/ and /tmp/dhcp.leases from the jail mounts (and replacing /etc/dnsmasq.conf with /etc/dnsmasq2.conf and removing the generated config file from the jail mounts)

results in a segfault of either ujail or dnsmasq

Without using a jail for the second instance, dnsmasq starts both instances correctly (first jailed, second not).

I use this to force an alternate DNS server for selected hosts (via iptables DNAT for specific mac_source(s))

Attachments (0)

Change History (3)

comment:1 Changed 2 years ago by anonymous

Can you use strace a bit?

comment:2 Changed 2 years ago by openwrt@…

a) this is on chaos-calmer not trunk
b) I haven't figure out how to be able to get an strace from *within* the jail, but will try stracing the ujail command when I get a chance (not sure how useful that will be though).
c) I also plan on trying to add debugging symbols to dnsmasq so I can actually get a backtrace instead of useless hex using gdb
d) I suspect the issue is ubus since I'm guessing the issue with a second of dnsmasq if some unanticipated code paths and ubus is not ordinarily part of dnsmasq and dnsmasq itself if perfectly fine with multiple instances (I've done it in previous releases; now trying to use procd to do the same thing with the added jail feature).

comment:3 Changed 2 years ago by openwrt@…

Via strace -f ujail ... I was able to find the issue (I should have skipped the whole trying to run strace withing the jail and done this to begin with).

It turns out dnsmasq segfaults when /etc/resolv.conf is not available!

I don't know why it was an issue for the second instance and not the first - perhaps --no-resolv results in use of /etc/resolv.conf which is not the case using default /tmp/

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.