Adblock crashes dnsmasq (SIGSEGV) in recent trunk

In recent trunk builds (specifically, using dnsmasq 2.86), now running r17747, I cannot use Adblock without crashing dnsmasq. The relevant messages in syslog are the following:

Wed Oct 13 09:15:33 2021 kern.info kernel: [58289.878532] do_page_fault(): sending SIGSEGV to dnsmasq for invalid read access from 6f727468
Wed Oct 13 09:15:33 2021 kern.info kernel: [58289.887236] epc = 555ad4cb in dnsmasq[5559a000+41000]
Wed Oct 13 09:15:33 2021 kern.info kernel: [58289.892394] ra  = 555aef39 in dnsmasq[5559a000+41000]

And then:
daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 6 crashes, 19 seconds since last crash

Other messages are only related to dnsmasq restarting:

Wed Oct 13 09:15:45 2021 daemon.info dnsmasq[2589]: started, version 2.86 cachesize 150
Wed Oct 13 09:15:45 2021 daemon.info dnsmasq[2589]: compile time options: IPv6 GNU-getopt no-RTC no-DBus UBus no-i18n no-IDN DHCP DHCPv6 no-Lua no-TFTP conntrack ipset auth cryptohash DNSSEC no-ID loop-detect inotify dumpfile
Wed Oct 13 09:15:45 2021 daemon.info dnsmasq[2589]: UBus support enabled: connected to system bus
Wed Oct 13 09:15:45 2021 daemon.info dnsmasq-dhcp[2589]: DHCP, IP range 192.168.196.1 -- 192.168.196.89, lease time 7d
Wed Oct 13 09:15:45 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for test
Wed Oct 13 09:15:45 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for onion
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for localhost
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for local
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for invalid
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for bind
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for www.distinctfreight.co.zw
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for candid.zone
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for dlvr.it
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for admarkt.marktplaats.nl
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for googleadservices.com
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for ziggo.nl
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for tinyurl.com
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for bit.ly
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for youtu.be
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for tweakers.net
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for avbohemen.lok
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using 19330 more local addresses
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: reading /tmp/resolv.conf.d/resolv.conf.auto
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using nameserver 84.116.46.23#53
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using nameserver 84.116.46.22#53
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for test
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for onion
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for localhost
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for local
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for invalid
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for bind
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for www.distinctfreight.co.zw
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using only locally-known addresses for candid.zone
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for dlvr.it
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for admarkt.marktplaats.nl
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for googleadservices.com
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for ziggo.nl
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for tinyurl.com
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for bit.ly
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for youtu.be
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for tweakers.net
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using standard nameservers for avbohemen.lok
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: using 19330 more local addresses
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: read /etc/hosts - 6 addresses
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: read /tmp/hosts/dhcp.cfg01411c - 2 addresses
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq[2589]: read /tmp/hosts/odhcpd - 3 addresses
Wed Oct 13 09:15:46 2021 daemon.info dnsmasq-dhcp[2589]: read /etc/ethers - 0 addresses

No messages indicating memory pressure. My blocklist used to be ~100,000 entries and it ran fine with dnsmasq 2.85. Router is a TP-Link Archer C7 v2 (128MB RAM). To be sure that the size of the blocklist was not an issue, I reduced the list first to ~50,000 entries and then 20,000. Still crashes.

Configs:

Adblock:

config adblock 'global'
        option adb_enabled '1'
        option adb_debug '0'
        option adb_forcedns '0'
        option adb_safesearch '0'
        option adb_dnsfilereset '0'
        option adb_mail '0'
        option adb_report '0'
        option adb_maxqueue '4'
        option adb_dns 'dnsmasq'
        option adb_fetchutil 'uclient-fetch'
        option adb_trigger 'wan'
        option adb_backup '0'
        list adb_sources 'adaway'
        list adb_sources 'adguard_tracking'
        list adb_sources 'bitcoin'
        list adb_sources 'openphish'
        list adb_sources 'smarttv_tracking'
        list adb_sources 'winspy'

Dnsmasq (from /etc/config/dhcp)

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option local '/avbohemen.lok/'
        option domain 'avbohemen.lok'
        option filterwin2k '1'
        list addnhosts '/tmp/adb_list.overall'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option confdir '/tmp/dnsmasq.d'

The crash does not occur when I disable adblock completely.
Anyone got any ideas?

remove that entry and try again. That's not set by adblock.

Done. Still same crash, after 17 seconds:

Wed Oct 13 13:21:00 2021 user.info adblock-4.1.3[6768]: blocklist with overall 19331 blocked domains loaded successfully (TP-Link Archer C7 v2, OpenWrt SNAPSHOT r17747-9d994f35b4)
Wed Oct 13 13:21:37 2021 kern.info kernel: [73054.307295] do_page_fault(): sending SIGSEGV to dnsmasq for invalid read access from 6f727468
Wed Oct 13 13:21:37 2021 kern.info kernel: [73054.316025] epc = 555b54cb in dnsmasq[555a2000+41000]
Wed Oct 13 13:21:37 2021 kern.info kernel: [73054.321161] ra  = 555b6f39 in dnsmasq[555a2000+41000]

Sorry, no more ideas ... check if there any unusual files in /tmp/dnsmasq.d (or reboot the router). I'm on the same snapshot level and it's not reproducible for me ...

1 Like

There was a talk about newer dnsmasq versions not supporting ipsets properly, could it be the case?

I have ipset enabled, I selected dnsmasq-full and ipset (actually, I selected everything except tftp). So, ipsets should work.

I reverted back to dnsmasq 2.85 and everythis is ok with adblock again.