From 2f9f0ec3b08663c25202b13c40696fd76a1d0540 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 22 Feb 2022 19:42:50 +0100 Subject: [PATCH] l3cfg: fix assertion failure for zombie in _obj_states_externally_removed_track() We can get a platform signal for any number of reasons. In particular, we can get a signal that the object is present in platform, while the object is tracked as zombie. "Zombies" are objects that were actively configured by NetworkManager, but now no longer and thus will need to be removed. We remember them as objects that we need to delete. The assertion was wrong. We don't need to handle the case "in_platform" and linked in "os_zombie_lst" specially. If we get a signal that the object exists while being a zombie, that is fine and not something to handle specially. Backtrace: #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007f6a208f1db5 in __GI_abort () at abort.c:79 #2 0x00007f6a212ed123 in g_assertion_message (domain=, file=, line=, func=0x560e23ada2c0 <__func__.39909> "_obj_states_externally_removed_track", message=) at gtestutils.c:2533 #3 0x00007f6a2134620e in g_assertion_message_expr (domain=domain@entry=0x560e23b781a0 "nm", file=file@entry=0x560e23acec60 "src/core/nm-l3cfg.c", line=line@entry=920, func=func@entry=0x560e23ada2c0 <__func__.39909> "_obj_states_externally_removed_track", expr=expr@entry=0x560e23ad1980 "c_list_is_empty(&obj_state->os_zombie_lst)") at gtestutils.c:2556 #4 0x0000560e23853f38 in _obj_states_externally_removed_track (self=self@entry=0x560e25f168e0, obj=, obj@entry=0x560e25e466a0, in_platform=in_platform@entry=1) at src/core/nm-l3cfg.c:920 #5 0x0000560e2385b8ea in _nm_l3cfg_notify_platform_change (self=0x560e25f168e0, change_type=change_type@entry=NM_PLATFORM_SIGNAL_CHANGED, obj=0x560e25e466a0) at src/core/nm-l3cfg.c:1364 #6 0x0000560e23861251 in _platform_signal_cb (platform=, obj_type_i=, ifindex=, platform_object=0x560e25e466b8, change_type_i=2, p_self=) at ./src/libnm-platform/nmp-object.h:443 #7 0x00007f6a1c4a914e in ffi_call_unix64 () at ../src/x86/unix64.S:76 #8 0x00007f6a1c4a8aff in ffi_call (cif=cif@entry=0x7fffac40e570, fn=fn@entry=0x560e23861100 <_platform_signal_cb>, rvalue=, avalue=avalue@entry=0x7fffac40e480) at ../src/x86/ffi64.c:525 #9 0x00007f6a217fee85 in g_cclosure_marshal_generic (closure=, return_gvalue=, n_param_values=, param_values=, invocation_hint=, marshal_data=) at gclosure.c:1490 #10 0x00007f6a217fe3bd in g_closure_invoke (closure=0x560e25df53c0, return_value=0x0, n_param_values=5, param_values=0x7fffac40e7a0, invocation_hint=0x7fffac40e720) at gclosure.c:804 #11 0x00007f6a21811945 in signal_emit_unlocked_R (node=node@entry=0x7f6a00008870, detail=detail@entry=0, instance=instance@entry=0x560e25ddd080, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffac40e7a0) at gsignal.c:3636 #12 0x00007f6a2181aa56 in g_signal_emit_valist (instance=, signal_id=, detail=, var_args=var_args@entry=0x7fffac40e9c0) at gsignal.c:3392 #13 0x00007f6a2181b093 in g_signal_emit (instance=instance@entry=0x560e25ddd080, signal_id=, detail=detail@entry=0) at gsignal.c:3448 #14 0x0000560e2392deea in nm_platform_cache_update_emit_signal (self=0x560e25ddd080, cache_op=NMP_CACHE_OPS_UPDATED, obj_old=, obj_new=) at src/libnm-platform/nm-platform.c:8824 #15 0x0000560e238fd520 in event_handler_recvmsgs () at src/libnm-platform/nm-linux-platform.c:7183 #16 0x0000560e238fdcbf in event_handler_read_netlink () at src/libnm-platform/nm-linux-platform.c:9403 #17 0x0000560e238ffab3 in delayed_action_handle_one () at src/libnm-platform/nm-linux-platform.c:6238 #18 0x0000560e238ffcae in delayed_action_handle_all () at src/libnm-platform/nm-linux-platform.c:6256 #19 0x0000560e23901acc in do_delete_object () at src/libnm-platform/nm-linux-platform.c:7392 #20 0x0000560e2390227c in ip4_address_delete () at src/libnm-platform/nm-linux-platform.c:8782 #21 0x0000560e23922709 in nm_platform_ip4_address_delete (self=self@entry=0x560e25ddd080, ifindex=ifindex@entry=150, address=16843009, plen=, peer_address=16843009) at src/libnm-platform/nm-platform.c:3574 #22 0x0000560e239275ab in nm_platform_ip_address_sync (self=0x560e25ddd080, addr_family=addr_family@entry=2, ifindex=150, known_addresses=, known_addresses@entry=0x0, addresses_prune=0x560e25e81aa0) at src/libnm-platform/nm-platform.c:3984 #23 0x0000560e23855e17 in _l3_commit_one (self=0x560e25f168e0, addr_family=2, commit_type=, l3cd_old=, changed_combined_l3cd=) at src/core/nm-l3cfg.c:4256 #24 0x0000560e2385fc5c in _l3_commit (self=0x560e25f168e0, commit_type=NM_L3_CFG_COMMIT_TYPE_REAPPLY, is_idle=) at src/core/nm-l3cfg.c:4353 #25 0x0000560e239c6a6d in nm_device_cleanup (self=0x560e25e985e0, reason=, cleanup_type=CLEANUP_TYPE_DECONFIGURE) at src/core/devices/nm-device.c:15082 #26 0x0000560e239c7522 in _set_state_full (self=0x560e25e985e0, state=, reason=, quitting=0) at src/core/devices/nm-device.c:15467 #27 0x0000560e239cd482 in queued_state_set (user_data=user_data@entry=0x560e25e985e0) at src/core/devices/nm-device.c:15706 #28 0x00007f6a2131b27b in g_idle_dispatch (source=0x560e25ebab60, callback=0x560e239cd3d0 , user_data=0x560e25e985e0) at gmain.c:5579 #29 0x00007f6a2131e95d in g_main_dispatch (context=0x560e25d97bc0) at gmain.c:3193 #30 g_main_context_dispatch (context=context@entry=0x560e25d97bc0) at gmain.c:3873 #31 0x00007f6a2131ed18 in g_main_context_iterate (context=0x560e25d97bc0, block=block@entry=1, dispatch=dispatch@entry=1, self=) at gmain.c:3946 #32 0x00007f6a2131f042 in g_main_loop_run (loop=0x560e25d730f0) at gmain.c:4142 #33 0x0000560e237c06ec in main (argc=, argv=) at src/core/main.c:509 Fixes: 929eae245d5d ('l3cfg: implement NM_L3CFG_CONFIG_FLAGS_ASSUME_CONFIG_ONCE and rework object state') (cherry picked from commit 849a4eee5c06e6f5eb70a4616e0060ba66a6c5e4) --- src/core/nm-l3cfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 7d00264b01..eeb041d042 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -917,7 +917,9 @@ _obj_states_externally_removed_track(NML3Cfg *self, const NMPObject *obj, gboole return; } - nm_assert(c_list_is_empty(&obj_state->os_zombie_lst)); + /* Even if this is a zombie (os_zombie_lst), it is still in platform. We continue + * tracking it, until it gets deleted from platform or until the os_zombie_count + * drops to zero. We don't need to handle this specially here. */ if (in_platform) { nmp_object_ref_set(&obj_state->os_plobj, obj);