GNOME Bugzilla – Bug 742928
Don't assert if object_type_from_nl_object() returns UNKNOWN
Last modified: 2015-02-25 14:09:02 UTC
E.g. Connect: ppp0 <--> /dev/ttyACM0 nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish' NetworkManager[27434]: <info> (ppp0): new Generic device (driver: 'unknown' ifindex: 12) NetworkManager[27434]: <info> (ppp0): exported as /org/freedesktop/NetworkManager/Devices/4 [Thread 0x7ffff1ecf700 (LWP 27439) exited] NetworkManager[27434]: <info> (ttyACM0): device state change: ip-config -> deactivating (reason 'user-requested') [70 110 39] Terminating on signal 15 nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 10 / phase 'terminate' ** NetworkManager:ERROR:platform/nm-linux-platform.c:1534:object_has_ifindex: code should not be reached Program received signal SIGABRT, Aborted. 0x00007ffff4692a97 in raise () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007ffff4692a97 in raise () from /usr/lib/libc.so.6 #1 0x00007ffff4693e6a in abort () from /usr/lib/libc.so.6 #2 0x00007ffff4c8d7f5 in g_assertion_message () from /usr/lib/libglib-2.0.so.0 #3 0x00007ffff4c8d88a in g_assertion_message_expr () from /usr/lib/libglib-2.0.so.0 #4 0x0000000000472b91 in object_has_ifindex (object=0x8a8320, ifindex=12) at platform/nm-linux-platform.c:1534 #5 0x0000000000472bec in check_cache_items (platform=0x7fe8a0, cache=0x7fda30, ifindex=12) at platform/nm-linux-platform.c:1549 #6 0x0000000000472de3 in announce_object (platform=0x7fe8a0, object=0x8a8c30, change_type=NM_PLATFORM_SIGNAL_REMOVED, reason=NM_PLATFORM_REASON_EXTERNAL) at platform/nm-linux-platform.c:1617 #7 0x0000000000473dd2 in event_notification (msg=0x8a7970, user_data=0x7fe8a0) at platform/nm-linux-platform.c:1992 #8 0x00007ffff5ee14de in nl_recvmsgs_report () from /usr/lib/libnl-3.so.200 #9 0x00007ffff5ee1849 in nl_recvmsgs () from /usr/lib/libnl-3.so.200 #10 0x00000000004794df in event_handler (channel=0x7fc930, io_condition=G_IO_IN, user_data=0x7fe8a0) at platform/nm-linux-platform.c:4152 #11 0x00007ffff4c6791d in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #12 0x00007ffff4c67cf8 in ?? () from /usr/lib/libglib-2.0.so.0 #13 0x00007ffff4c68022 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #14 0x00000000004477ee in main (argc=1, argv=0x7fffffffeaa8) at main.c:447 (gdb) fr 4 #4 0x0000000000472b91 in object_has_ifindex (object=0x8a8320, ifindex=12) at platform/nm-linux-platform.c:1534 1534 g_assert_not_reached ();
Created attachment 294537 [details] [review] Patch. Just changing assert vs warn in the patch.
Happens when priv->address_cache ends up storing an address object of AF_PHONET family; the code only handles IPv4 or IPv6 addresses and ends up assert()ing otherwise. Likely not even useful to have a g_warn_if_reached() there.
Comment on attachment 294537 [details] [review] Patch. Forget this patch, especially since it also lacks a return value after the warn :)
Created attachment 294552 [details] [review] Patch.
Comment on attachment 294552 [details] [review] Patch. Instead of ignoring here, I'll prepare a patch to avoid adding objects of unknown type all together in the cache.
Possibly a better option, as suggested by you on IRC, woudl be to ensure that addresses we don't care about don't get into the cache in the first place... Oh, and the reason I never see this is that Fedora apparently hasn't built cdc-phonet.ko for a long time... so the driver never shows up, I never get any phonet addresses, and nothing crashes :)
Created attachment 294574 [details] [review] Patch. This patch tries to make sure that the netlink object caches only contain known object types. I added this to all 3 caches (link, address and routes), but not sure if this is a good idea or not.
(In reply to comment #7) > Created an attachment (id=294574) [details] [review] > Patch. > > This patch tries to make sure that the netlink object caches only contain known > object types. I added this to all 3 caches (link, address and routes), but not > sure if this is a good idea or not. The patch LGTM as is.
(In reply to comment #7) > This patch tries to make sure that the netlink object caches only contain known > object types. I added this to all 3 caches (link, address and routes), but not > sure if this is a good idea or not. We shouldn't ever be doing anything with objects of types we don't recognize, so I can't think of any reason why we'd need them in our caches.
Pushed with a small fixup; should use 'cache' not 'priv->address_cache' in cache_remove_unknown(), which means we don't need 'priv' in that function at all. master: bf7865e8592f012261840662655aca01db0bba06 nm-1-0: 495361084699d4d73d8401f4e2b23cc8effa23d3 nm-0-9-10: 5bcd8ca52bcca6ca6889218b6fe0a3086db4c6e3