Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 10685] Crash (segfault) when enabling monitor mode

Date: Sun, 05 Jun 2016 18:56:38 +0000

Comment # 7 on bug 10685 from
Created attachment 14614 [details]
Debugging patch

With the attached patch applied, if I enable monitor mode for an interface and
click "OK" in the Interface Settings dialog I get the following output:

11:36:21          Warn scan_local_interfaces: appending eth0
11:36:21          Warn scan_local_interfaces: appending br0
11:36:21          Warn scan_local_interfaces: appending virbr0
11:36:21          Warn scan_local_interfaces: appending vnet0
11:36:21          Warn scan_local_interfaces: appending wlan0
11:36:21          Warn scan_local_interfaces: appending nflog
11:36:21          Warn scan_local_interfaces: appending nfqueue
11:36:21          Warn scan_local_interfaces: appending vnet1
11:36:21          Warn scan_local_interfaces: appending wlan1
11:36:21          Warn scan_local_interfaces: appending wlan2
11:36:21          Warn scan_local_interfaces: appending any
11:36:21          Warn scan_local_interfaces: appending lo
11:36:31          Warn capture_prep_monitor_changed_cb remove iface wlan1 8
11:36:31          Warn capture_prep_monitor_changed_cb wlan1 1
11:36:31          Warn start loop
11:36:31          Warn end loop
11:36:31          Warn insert iface wlan1 8
11:36:31          Warn gtk_iface_mon_event_cb: wlan1 0
11:36:31          Warn gtk_iface_mon_event_cb: present 1 up 0
11:36:31          Warn refresh_local_interface_lists start
11:36:31          Warn scan_local_interfaces: removing lo 11
11:36:31          Warn scan_local_interfaces: removing any 10
11:36:31          Warn scan_local_interfaces: removing wlan2 9
11:36:31          Warn scan_local_interfaces: removing wlan1 8
11:36:31          Warn scan_local_interfaces: removing vnet1 7
11:36:31          Warn scan_local_interfaces: removing nfqueue 6
11:36:31          Warn scan_local_interfaces: removing nflog 5
11:36:31          Warn scan_local_interfaces: removing wlan0 4
11:36:31          Warn scan_local_interfaces: removing vnet0 3
11:36:31          Warn scan_local_interfaces: removing virbr0 2
11:36:31          Warn scan_local_interfaces: removing br0 1
11:36:31          Warn scan_local_interfaces: removing eth0 0
11:36:31          Warn scan_local_interfaces: appending eth0
11:36:31          Warn scan_local_interfaces: appending br0
11:36:31          Warn scan_local_interfaces: appending virbr0
11:36:31          Warn scan_local_interfaces: appending vnet0
11:36:31          Warn scan_local_interfaces: appending wlan0
11:36:31          Warn scan_local_interfaces: appending nflog
11:36:31          Warn scan_local_interfaces: appending nfqueue
11:36:31          Warn scan_local_interfaces: appending vnet1
11:36:32          Warn scan_local_interfaces: appending wlan1
11:36:32          Warn scan_local_interfaces: appending wlan2
11:36:32          Warn scan_local_interfaces: appending any
11:36:32          Warn scan_local_interfaces: appending lo
11:36:32          Warn refresh_local_interface_lists end
11:36:32          Warn gtk_iface_mon_event_cb: wlan1 0
11:36:32          Warn gtk_iface_mon_event_cb: present 1 up 0
11:36:32          Warn refresh_local_interface_lists start
11:36:32          Warn scan_local_interfaces: removing lo 11
11:36:32          Warn scan_local_interfaces: removing any 10
11:36:32          Warn scan_local_interfaces: removing wlan2 9
11:36:32          Warn scan_local_interfaces: removing wlan1 8
11:36:32          Warn scan_local_interfaces: removing vnet1 7
11:36:32          Warn scan_local_interfaces: removing nfqueue 6
11:36:32          Warn scan_local_interfaces: removing nflog 5
11:36:32          Warn scan_local_interfaces: removing wlan0 4
11:36:32          Warn scan_local_interfaces: removing vnet0 3
11:36:32          Warn scan_local_interfaces: removing virbr0 2
11:36:32          Warn scan_local_interfaces: removing br0 1
11:36:32          Warn scan_local_interfaces: removing eth0 0
11:36:32          Warn scan_local_interfaces: appending eth0
11:36:32          Warn scan_local_interfaces: appending br0
11:36:32          Warn scan_local_interfaces: appending virbr0
11:36:32          Warn scan_local_interfaces: appending vnet0
11:36:32          Warn scan_local_interfaces: appending wlan0
11:36:32          Warn save_options_cb  removing 6 8

(wireshark-gtk:9934): GLib-CRITICAL **: g_array_remove_index: assertion 'index_
< array->len' failed

(wireshark-gtk:9934): GLib-CRITICAL **: g_array_insert_vals: assertion 'array'
failed
11:36:32          Warn save_options_cb  inserting 6 8
Segmentation fault (core dumped)


We do this all over the place:

    device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
    g_array_remove_index(global_capture_opts.all_ifaces, i);
    [ do a bunch of work ]
    g_array_insert_val(global_capture_opts.all_ifaces, i, device);

As Peter mentioned, this can result in a race condition if "do a bunch of work"
happens to process UI events. Is there any reason we don't:

Update devices in-place?

Disable missing items instead of removing them, similar to what we do with
recent files?

Have an "interface" API for getting and setting the various interface_t
members?


You are receiving this mail because:
  • You are watching all bug changes.