[Dnsmasq-discuss] segfault - Re: No dnsmasq after starting openVPN?!

richardvoigt at gmail.com richardvoigt at gmail.com
Sun Jun 6 18:06:45 BST 2010


On Sun, Jun 6, 2010 at 10:03 AM, Arno Wald <arno.wald at netcologne.de> wrote:
> On 06.06.2010 12:06, Arno Wald wrote:
>> I did not enter anything but just started openvpn. The dnsmasq process
>> did not disappear. In gdb I entered "c" and after this "bt" and "q":
>
> I did the same with a self compiled dnsmasq package following this guide
> http://jameswestby.net/tips/tips/compiling-debian-package-for-debug.html
>
> and the result is this:
>
> (gdb) c
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08067156 in netlink_multicast () at netlink.c:249
> 249           for (h = (struct nlmsghdr *)iov.iov_base; NLMSG_OK(h,
> (size_t)len); h = NLMSG_NEXT(h, len))
> (gdb) bt
> #0  0x08067156 in netlink_multicast () at netlink.c:249
> #1  0x0805cea5 in main (argc=9, argv=0xbfff3554) at dnsmasq.c:662
>
>
> Does this help?

Ought to help Simon a lot.  I'll make a couple suggestions but
ultimately Simon is the author and expert on all matters dnsmasq.

In netlink_recv, the return value of expand_buf is not checked.  But
this looks like it is by design: in case of failure iov.iov_base is
untouched, not NULL, so this can't be the segfault.
In netlink_recv, it might be a good defensive coding practice to
consider all negative values from recvmsg as errors, to avoid
requesting a negative (or absurdly large) amount of memory from
expand_buf.
Ditto when calling netlink_recv, a check for < 0 could be both faster
and more robust than == -1.
In the for loops in both iface_enumerate and netlink_multicast, it
feels like a bad idea to call NLMSG_OK with the same value of len
after calling NLMSG_NEXT.


>
> Greetings,
> Arno
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>



More information about the Dnsmasq-discuss mailing list