[Dnsmasq-discuss] [PATCH] DBus watchers change can trigger crash

Simon Kelley simon at thekelleys.org.uk
Mon Apr 17 20:29:02 UTC 2023


Both patches applied.

Cheers,

Simon.

On 17/04/2023 12:30, Petr Menšík wrote:
> Hi!
> 
> Interesting crash in dnsmasq were reported to me. I can reproduce it 
> reliably on RHEL9, but not anymore on the most recent Fedora. But the 
> difference seems to be based on used dbus library, not depending on 
> dnsmasq code. RHEL9 dbus libraries installs 2 daemon->watchers, Fedora 
> rawhide version does not. If those watchers are present and dbus system 
> instance is restarted, dnsmasq crashes. RHEL9 uses 
> dbus-libs-1.12.20-7.el9_1.x86_64.
> 
> If I configure dnsmasq to use dbus and then restart dbus.service with 
> watchers present, it crashes dnsmasq. The reason is simple, it uses loop 
> to walk over watchers to call dbus handling code. But from that code the 
> same list can be modified and watchers removed. But the list iteration 
> continues anyway.
> 
> In my first patch I fixed that problem by restarting the loop if list 
> were modified.
> 
> Second patch is just optimization of socket events handling of dbus. 
> Reduces calls to locate the file descriptor structure. Should lower CPU 
> usage when monitoring dbus watches. It is not directly related to the 
> issue, I just noticed repeated function calls where just one were needed.
> 
> Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=2185878
> 
> Cheers,
> Petr
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss



More information about the Dnsmasq-discuss mailing list