nmcli segfaults on ocassion when checking connectivity
On Gentoo, NetworkManager 1.26.2, glib 2.64.5, nmcli
segfaults on ocassion when running nmcli networking connectivity
:
[ 3426.288407] nmcli[68092]: segfault at 10 ip 00007f7d63960e9f sp 00007ffd4234e250 error 4 in libglib-2.0.so.0.6400.5[7f7d6392f000+81000][ 3426.288410] Code: 87 00 00 00 41 54 55 53 48 89 fb 8b 47 18 85 c0 7e 51 4c 8b 67 20 48 89 f5 4d 85 e4 74 2d 4c 89 e7 e8 95 e4 04 00 48 8b 43 58 <48> 3b 68 10 74 0a 48 89 68 10 f6 43 2c 40 74 71 5b 4c 89 e7 5d 41
Backtrace:
Starting program: /usr/bin/nmcli networking connectivity
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff6804700 (LWP 42088)]
[New Thread 0x7ffff6003700 (LWP 42089)]
[New Thread 0x7ffff5802700 (LWP 42090)]
full
Thread 1 "nmcli" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b41e9f in g_source_set_ready_time (source=0x7fffec01c290, ready_time=0) at ../glib-2.64.5/glib/gmain.c:1942
1942 ../glib-2.64.5/glib/gmain.c: No such file or directory.
(gdb) bt
#0 0x00007ffff7b41e9f in g_source_set_ready_time (source=0x7fffec01c290, ready_time=0) at ../glib-2.64.5/glib/gmain.c:1942
#1 0x00007ffff7cc6126 in cancellable_source_cancelled (cancellable=<optimized out>, user_data=0x7fffec01c290)
at ../glib-2.64.5/gio/gcancellable.c:666
#2 0x00007ffff7c2e0d6 in _g_closure_invoke_va
(closure=0x7fffec0402a0, return_value=0x0, instance=0x555555666760, args=0x7fffffffd880, n_params=0, param_types=0x0)
at ../glib-2.64.5/gobject/gclosure.c:873
#3 0x00007ffff7c4be12 in g_signal_emit_valist
(instance=0x555555666760, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd880)
at ../glib-2.64.5/gobject/gsignal.c:3407
#4 0x00007ffff7c4c3ef in g_signal_emit (instance=instance@entry=0x555555666760, signal_id=<optimized out>, detail=detail@entry=0)
at ../glib-2.64.5/gobject/gsignal.c:3554
#5 0x00007ffff7cc6798 in g_cancellable_cancel (cancellable=0x555555666760 [GCancellable]) at ../glib-2.64.5/gio/gcancellable.c:509
#6 0x00007ffff7d85124 in _g_dbus_worker_close (worker=0x7fffe800dae0, task=<optimized out>) at ../glib-2.64.5/gio/gdbusprivate.c:1721
#7 0x00007ffff7d85195 in _g_dbus_worker_stop (worker=0x7fffe800dae0) at ../glib-2.64.5/gio/gdbusprivate.c:1742
#8 0x00007ffff7d6fe00 in g_dbus_connection_dispose (object=0x5555556750b0 [GDBusConnection])
at ../glib-2.64.5/gio/gdbusconnection.c:613
#9 0x00007ffff7c32e93 in g_object_unref (_object=<optimized out>) at ../glib-2.64.5/gobject/gobject.c:3461
#10 g_object_unref (_object=0x5555556750b0) at ../glib-2.64.5/gobject/gobject.c:3391
#11 0x00007ffff7e90eb4 in dispose (object=0x55555566e130 [NMClient])
at /tmp/portage/net-misc/networkmanager-1.26.2/work/NetworkManager-1.26.2/libnm/nm-client.c:7868
#12 0x00007ffff7c32e93 in g_object_unref (_object=<optimized out>) at ../glib-2.64.5/gobject/gobject.c:3461
#13 g_object_unref (_object=0x55555566e130) at ../glib-2.64.5/gobject/gobject.c:3391
#14 0x000055555558e616 in nmc_cleanup (nmc=0x555555627da0 <nm_cli>)
at /tmp/portage/net-misc/networkmanager-1.26.2/work/NetworkManager-1.26.2/clients/cli/nmcli.c:945
#15 main (argc=3, argv=0x7fffffffdba8)
at /tmp/portage/net-misc/networkmanager-1.26.2/work/NetworkManager-1.26.2/clients/cli/nmcli.c:1008
As far as I can see, this is caused by g_clear_object
in nmc_cleanup
line 945; the .client
field of the static struct is NEVER used in nmcli.c
, so it should have the NULL
value assigned to it in line 76, therefore the real bug may be in glib's g_clear_object
. However, since the .client
field is never used I was able to fix the segfaults by simply removing lines 76 and 945 from nmcli.c
; if it's really never used, I think it should be removed.