[Goodies-dev] [patch] SIGSEGV bug in xfce4-netload-plugin

Mike Massonnet mmassonnet at gmail.com
Sun Nov 16 12:12:40 CET 2014


I pushed changes with an option 'Show values as bits' ;)
--
Mike


2014-11-15 23:38 GMT+01:00 Mike Massonnet <mmassonnet at gmail.com>:
> Actually I'm doing some changes on the format_byte_humanreadble
> function to display bits now.
>
> (I don't follow the m-l much at all (ccing goodies-dev at xfce.org), and
> I check bugzilla occasionnally, when someone bugs me on IRC or by
> email usually.)
> --
> Mike
>
>
> 2014-11-15 23:21 GMT+01:00 J.R. Oldroyd <jr at opal.com>:
>> Oh, this is discussed on the xfce mailing lists and bugzilla?
>> Why didn't I think of that?!!
>>
>> Thanks for adding the segfault fix so quickly.
>>
>> I may have some time next week.  If I do, I'll do the code for
>> the bits/bytes and K/Ki changes and send you another patch.  But
>> don't go holding your breath!
>>
>>         -jr
>>
>> On Sat, 15 Nov 2014 23:16:13 +0100 Mike Massonnet <mmassonnet at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I just released 1.2.3 with a fix for the segfault :)
>>>
>>> Regarding the bit/bytes values, there is a recent feature request in bugzilla:
>>> https://bugzilla.xfce.org/show_bug.cgi?id=9932
>>>
>>> Regarding the 1000/1024 values, there is alos one:
>>> https://bugzilla.xfce.org/show_bug.cgi?id=9932
>>>
>>> Just don't have time to hack that into the plugin, but there could
>>> definitely be options in the settings dialog.
>>>
>>> Cheers,
>>> --
>>> Mike
>>>
>>>
>>> 2014-11-15 21:38 GMT+01:00 J.R. Oldroyd <jr at opal.com>:
>>> > Cool, thanks.
>>> >
>>> > After sending that patch, I also thought that this tool should
>>> > really display the numbers in B, KB, MB, etc, rather than B, KiB,
>>> > MiB, etc.
>>> >
>>> > While storage is usually described in 1,024 byte blocks, moving
>>> > data is usually described in 1,000 block sizes.  Ethernet is
>>> > 100 Mbps, 1 Gbps, 10Gbps etc in 1,000 multiples; WiFi is 54, 150
>>> > and 300 Mbps; data lines like T1s, T3s are all in multiples of a
>>> > basic DS0 which is 64,000 bps.  Seems odd that this tool uses a
>>> > different multiple.
>>> >
>>> > Of course, folks may have their personal preference.  Perhaps we
>>> > should have options:
>>> >         Display unit:           bits -or- bytes
>>> >         Display multiple:       K (1,000) -or- Ki (1,024)
>>> >
>>> > Cheers,
>>> >         -jr
>>> >
>>> >
>>> > On Sat, 15 Nov 2014 21:20:14 +0100 Mike Massonnet <mmassonnet at gmail.com> wrote:
>>> >>
>>> >> Hello,
>>> >>
>>> >> I'm looking into it, thanks for the report.
>>> >>
>>> >> --
>>> >> Mike
>>> >>
>>> >>
>>> >> 2014-11-14 16:28 GMT+01:00 J.R. Oldroyd <jr at opal.com>:
>>> >> > Hi,
>>> >> >
>>> >> > Not sure who is the developer for this at the moment, so sorry if
>>> >> > it isn't you.  Maybe you could forward this?  Also including the
>>> >> > FreeBSD port maintainer.
>>> >> >
>>> >> > Since doing a major upgrade here some weeks back (FreeBSD 10.0,
>>> >> > xfce-4.10, netload-plugin-1.20), I've been having regular (as in 10x
>>> >> > per hour) crashes of xfce4-netload-plugin.  The symptom is a pop-up
>>> >> > saying that the plugin "left the panel unexpectedly" and do I want to
>>> >> > restart it.  Very annoying to have that all the time.
>>> >> >
>>> >> > The log revealed:
>>> >> >
>>> >> > Nov 13 11:46:56 shibato kernel: pid 12782 (xfce4-netload-plugi), uid 1001: exited on signal 10 (core dumped)
>>> >> >
>>> >> > and, after updating to the latest plugin (1.22), today:
>>> >> >
>>> >> > Nov 14 08:24:38 shibato kernel: pid 28201 (wrapper), uid 1001: exited on signal 11 (core dumped)
>>> >> >
>>> >> > And gdb:
>>> >> >
>>> >> > $ gdb /usr/local/lib/xfce4/panel/wrapper wrapper.core
>>> >> > ...
>>> >> > Core was generated by `wrapper'.
>>> >> > Program terminated with signal 11, Segmentation fault.
>>> >> > ...
>>> >> > (gdb) bt
>>> >> > #0  0x00000008026d5e85 in strlcat () from /lib/libc.so.7
>>> >> > #1  0x000000080845cfdc in xfce_panel_module_construct () from /usr/local/lib/xfce4/panel/plugins/libnetload.so
>>> >> > #2  0x000000080845ba76 in xfce_panel_module_construct () from /usr/local/lib/xfce4/panel/plugins/libnetload.so
>>> >> > #3  0x00000008020e3004 in g_list_sort_with_data () from /usr/local/lib/libglib-2.0.so.0
>>> >> > #4  0x00000008020e6702 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0
>>> >> > #5  0x00000008020e6aa3 in g_main_context_pending () from /usr/local/lib/libglib-2.0.so.0
>>> >> > #6  0x00000008020e6dcf in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.0
>>> >> > #7  0x0000000800b88a0f in gtk_main () from /usr/local/lib/libgtk-x11-2.0.so.0
>>> >> > #8  0x00000000004037df in main ()
>>> >> > (gdb)
>>> >> >
>>> >> > which is not a very helpful backtrace, but grepping shows only one
>>> >> > call to strlcat() in this plugin code in utils.c.
>>> >> >
>>> >> > Examining that code led me to the attached patch.
>>> >> >
>>> >> > The main error and fix is that the array index, uidx, is compared to
>>> >> >     sizeof(unit_names)
>>> >> > but it should be
>>> >> >     sizeof(unit_names)/sizeof(unit_names[0])
>>> >> > I think this limit check is being hit if the plugin doesn't run
>>> >> > briefly and during that time there is a burst of network traffic
>>> >> > which yields an unusually high number.
>>> >> >
>>> >> > While here, I also noticed that the initial number is already divided
>>> >> > by 1024 and shown as KiB which means network transfers of a few bytes
>>> >> > cannot be seen.  I changed it so just a few bytes are shown.
>>> >> >
>>> >> > And I also added some more units to the array - probably won't be
>>> >> > needed any time soon, so keep or leave this part as you wish.
>>> >> >
>>> >> > I have not seen any further crashes since applying this patch.
>>> >> >
>>> >> >         -jr
>>> >
>>


More information about the Goodies-dev mailing list