mirror_frr/zebra
Philippe Guibert bcdc8249b9 zebra: fix heap-use-after free on ns shutdown
The following ASAN issue has been observed:

> ERROR: AddressSanitizer: heap-use-after-free on address 0x6160000acba4 at pc 0x55910c5694d0 bp 0x7ffe3a8ac850 sp 0x7ffe3a8ac840
> READ of size 4 at 0x6160000acba4 thread T0
>         #0 0x55910c5694cf in ctx_info_from_zns zebra/zebra_dplane.c:3315
>     #1 0x55910c569696 in dplane_ctx_ns_init zebra/zebra_dplane.c:3331
>     #2 0x55910c56bf61 in dplane_ctx_nexthop_init zebra/zebra_dplane.c:3680
>     #3 0x55910c5711ca in dplane_nexthop_update_internal zebra/zebra_dplane.c:4490
>     #4 0x55910c571c5c in dplane_nexthop_delete zebra/zebra_dplane.c:4717
>     #5 0x55910c61e90e in zebra_nhg_uninstall_kernel zebra/zebra_nhg.c:3413
>     #6 0x55910c615d8a in zebra_nhg_decrement_ref zebra/zebra_nhg.c:1919
>     #7 0x55910c6404db in route_entry_update_nhe zebra/zebra_rib.c:454
>     #8 0x55910c64c904 in rib_re_nhg_free zebra/zebra_rib.c:2822
>     #9 0x55910c655be2 in rib_unlink zebra/zebra_rib.c:4212
>     #10 0x55910c6430f9 in zebra_rtable_node_cleanup zebra/zebra_rib.c:968
>     #11 0x7f26f275b8a9 in route_node_free lib/table.c:75
>     #12 0x7f26f275bae4 in route_table_free lib/table.c:111
>     #13 0x7f26f275b749 in route_table_finish lib/table.c:46
>     #14 0x55910c65db17 in zebra_router_free_table zebra/zebra_router.c:191
>     #15 0x55910c65dfb5 in zebra_router_terminate zebra/zebra_router.c:244
>     #16 0x55910c4f40db in zebra_finalize zebra/main.c:249
>     #17 0x7f26f2777108 in event_call lib/event.c:2011
>     #18 0x7f26f264180e in frr_run lib/libfrr.c:1212
>     #19 0x55910c4f49cb in main zebra/main.c:531
>     #20 0x7f26f2029d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>     #21 0x7f26f2029e3f in __libc_start_main_impl ../csu/libc-start.c:392
>     #22 0x55910c4b0114 in _start (/usr/lib/frr/zebra+0x1ae114)

It happens with FRR using the kernel. During shutdown, the
namespace identifier is attempted to be obtained by zebra, in an
attempt to prepare zebra dataplane nexthop messages.

Fix this by accessing the ns structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 7ae70eb5ef)
2024-10-16 14:49:50 +00:00
..
dpdk zebra: Update Zebra for DPDK >=22.11 API 2024-05-16 14:26:26 +03:00
.gitignore zebra: Add fpm_listener 2024-03-04 11:06:35 -05:00
connected.c zebra: Prevent a kernel route from being there when a connected should 2024-10-15 19:05:50 +00:00
connected.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
debug_nl.c zebra: add some more netlink RTA_ strings 2024-05-09 16:56:07 -04:00
debug.c zebra: add zebra to mgmtd oper-state 2023-12-28 17:53:40 +00:00
debug.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
dplane_fpm_nl.c zebra: Fix crash during reconnect 2024-10-04 14:59:14 +07:00
fpm_listener.c Merge pull request #15082 from louis-6wind/fix-iff-lower-up 2024-05-29 00:01:20 +03:00
ge_netlink.c zebra: Fetch actual SRv6 encap src addr on startup 2023-12-14 14:58:35 +01:00
ge_netlink.h zebra: Fetch actual SRv6 encap src addr on startup 2023-12-14 14:58:35 +01:00
if_ioctl.c zebra: fix loading kernel routs without netlink 2024-08-16 10:42:33 +02:00
if_netlink.c zebra: remove unused function from if_netlink.c 2024-10-06 19:25:44 -04:00
if_netlink.h zebra: remove unused function from if_netlink.c 2024-10-06 19:25:44 -04:00
if_socket.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
if_sysctl.c zebra: fix loading kernel routs without netlink 2024-08-16 10:42:33 +02:00
interface.c zebra: Handle kernel routes appropriately 2024-08-27 06:25:34 -04:00
interface.h zebra: Remove ifp_nhg_XXX functions completely 2024-02-08 11:56:40 -05:00
ioctl.c *: Remove sys/ioctl.h from zebra.h 2024-01-04 14:42:17 -05:00
ioctl.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
ipforward_proc.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
ipforward_sysctl.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
ipforward.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
irdp_interface.c zebra: convert interface configuration output to NB 2024-01-28 23:28:40 +02:00
irdp_main.c *: convert struct interface->connected to DLIST 2023-11-22 23:00:30 +01:00
irdp_packet.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
irdp.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
kernel_netlink.c zebra: Remove nl_addraw_l 2024-09-19 08:28:48 -04:00
kernel_netlink.h zebra: Remove nl_addraw_l 2024-09-19 08:28:48 -04:00
kernel_socket.c zebra: fix loading kernel routs without netlink 2024-08-16 10:42:33 +02:00
kernel_socket.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
label_manager.c zebra: Cleanup linked list on shutdown in label manager 2023-12-11 15:26:20 -05:00
label_manager.h zebra: Cleanup linked list on shutdown in label manager 2023-12-11 15:26:20 -05:00
main.c zebra: fix heap-use-after free on ns shutdown 2024-10-16 14:49:50 +00:00
Makefile build: convert zebra/ to non-recursive build 2017-07-31 23:03:30 +02:00
netconf_netlink.c *: zebra.h should not have fcntl.h 2024-01-09 12:50:40 -05:00
netconf_netlink.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
redistribute.c zebra: Add more vrf name to debugs 2024-09-11 15:30:43 -04:00
redistribute.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
rib.h zebra: remove unused function rib_lookup_ipv4 2024-10-06 18:53:11 -04:00
router-id.c zebra: convert to mgmtd 2024-01-28 23:28:40 +02:00
router-id.h zebra: convert vrf configuration output to NB 2024-01-28 23:28:40 +02:00
rt_netlink.c *: Allow 16 bit size for nexthops 2024-10-08 09:26:57 -04:00
rt_netlink.h zebra: support route replace semantics in FPM 2023-09-04 15:38:03 -03:00
rt_socket.c lib: remove net/route.h it is not used 2024-01-09 12:50:40 -05:00
rt.h *: Introduce Local Host Routes to FRR 2023-11-01 17:13:06 -04:00
rtadv.c *: Fix spelling errors found 2024-08-15 09:19:37 -04:00
rtadv.h zebra: convert interface ipv6 nd dnssl command to NB 2024-01-28 23:28:40 +02:00
rtread_netlink.c Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
rtread_sysctl.c lib: remove net/route.h it is not used 2024-01-09 12:50:40 -05:00
rule_netlink.c *: Remove netlink headers from lib/zebra.h 2023-11-07 06:46:19 -05:00
rule_netlink.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
rule_socket.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
sample_plugin.c *: Convert struct event_master to struct event_loop 2023-03-24 08:32:17 -04:00
subdir.am zebra: Add show fpm status [json] command 2024-03-04 11:06:35 -05:00
table_manager.c lib, mgmtd, zebra: cleanup of zebra conversion to mgmtd 2024-01-28 23:46:38 +02:00
table_manager.h zebra: convert table range command to NB 2024-01-28 23:28:40 +02:00
tc_netlink.c zebra: remove unsued function from tc_netlink.c 2024-10-06 19:30:56 -04:00
tc_netlink.h zebra: remove unused function from tc_netlink.c 2024-10-06 19:08:44 -04:00
tc_socket.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
testrib.conf
zapi_msg.c *: Allow 16 bit size for nexthops 2024-10-08 09:26:57 -04:00
zapi_msg.h zebra: Do not forget to free opaque data for route entry 2024-08-13 18:00:30 +03:00
zebra_affinitymap.c zebra: rework affinity-map update hook 2024-01-19 03:47:11 +02:00
zebra_affinitymap.h lib,zebra: add affinity-map configuration hooks 2023-02-10 13:52:01 +01:00
zebra_cli.c zebra: add 'mpls fec nexthop-resolution' command to vtysh 2024-06-07 12:33:47 +02:00
zebra_cli.h zebra: convert to mgmtd 2024-01-28 23:28:40 +02:00
zebra_dplane.c *: Allow 16 bit size for nexthops 2024-10-08 09:26:57 -04:00
zebra_dplane.h *: Allow 16 bit size for nexthops 2024-10-08 09:26:57 -04:00
zebra_errors.c zebra: Add functions to alloc/release SRv6 SIDs 2024-06-13 14:54:16 +02:00
zebra_errors.h zebra: Add functions to alloc/release SRv6 SIDs 2024-06-13 14:54:16 +02:00
zebra_evpn_mac.c zebra: In zebra_evpn_mac.c remove bad comments 2024-09-18 07:35:54 -04:00
zebra_evpn_mac.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
zebra_evpn_mh.c bgpd, lib, zebra: Extend ES_VTEP_LIST_STR_SZ to support IPv6 addresses 2024-05-31 10:27:22 -04:00
zebra_evpn_mh.h zebra: bridge flap handle vlan membership update 2024-05-03 10:52:33 -07:00
zebra_evpn_neigh.c *: Remove netlink headers from lib/zebra.h 2023-11-07 06:46:19 -05:00
zebra_evpn_neigh.h *: Convert THREAD_XXX macros to EVENT_XXX macros 2023-03-24 08:32:17 -04:00
zebra_evpn_vxlan.h Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
zebra_evpn.c zebra: unlock if_table route_nodes 2024-09-20 12:24:01 -04:00
zebra_evpn.h Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
zebra_fpm_dt.c *: Remove netlink headers from lib/zebra.h 2023-11-07 06:46:19 -05:00
zebra_fpm_netlink.c zebra: changes for code maintainability 2024-03-12 12:00:12 +05:30
zebra_fpm_private.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_fpm_protobuf.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_fpm.c *: Remove netlink headers from lib/zebra.h 2023-11-07 06:46:19 -05:00
zebra_gr.c zebra: Do not assign time and then never use it 2024-08-18 16:18:54 -04:00
zebra_l2_bridge_if.c *: Add a hash_clean_and_free() function 2023-03-21 08:54:21 -04:00
zebra_l2_bridge_if.h zebra: multiple vlan aware bridge data structure and related changes 2023-02-13 18:12:04 -05:00
zebra_l2.c zebra: bridge flap handle vlan membership update 2024-05-03 10:52:33 -07:00
zebra_l2.h zebra: Use zebra dplane for RTM link and addr 2023-07-05 13:03:14 -04:00
zebra_mlag_private.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
zebra_mlag_vty.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_mlag_vty.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_mlag.c *: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ 2023-11-21 08:08:29 -05:00
zebra_mlag.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_mpls_netlink.c *: remove sys/stat.h from zebra.h 2024-01-09 12:39:23 -05:00
zebra_mpls_null.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_mpls_openbsd.c zebra: changes for code maintainability 2024-03-21 14:56:24 +05:30
zebra_mpls_vty.c zebra: fix mpls command 2024-05-16 23:30:41 +08:00
zebra_mpls.c Merge pull request #15259 from dmytroshytyi-6WIND/nexthop_resolution 2024-09-10 10:04:08 -04:00
zebra_mpls.h zebra: return void zebra_mpls_lsp_install 2024-06-07 12:33:48 +02:00
zebra_mroute.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_mroute.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_nb_config.c zebra: add 'mpls fec nexthop-resolution' command to vtysh 2024-06-07 12:33:47 +02:00
zebra_nb_rpcs.c zebra: clear evpn dup-addr return error-msg when there is no vni 2024-06-20 15:05:37 -07:00
zebra_nb_state.c yang: add missing zif-gre zebra interface type 2024-04-20 08:04:00 -04:00
zebra_nb.c zebra: add 'mpls fec nexthop-resolution' command to vtysh 2024-06-07 12:33:47 +02:00
zebra_nb.h zebra: add 'mpls fec nexthop-resolution' command to vtysh 2024-06-07 12:33:47 +02:00
zebra_neigh.c zebra: changes for code maintainability 2024-03-26 10:21:45 +05:30
zebra_neigh.h zebra: Remove static ARP entries on interface down events 2023-11-06 15:00:59 +02:00
zebra_netns_id.c zebra: changes for code maintainability 2024-03-26 10:21:45 +05:30
zebra_netns_id.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_netns_notify.c zebra: Mimic GNU basename() API for non-glibc library e.g. musl 2024-08-22 14:50:41 -07:00
zebra_netns_notify.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_nhg_private.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_nhg.c *: Allow 16 bit size for nexthops 2024-10-08 09:26:57 -04:00
zebra_nhg.h *: Allow 16 bit size for nexthops 2024-10-08 09:26:57 -04:00
zebra_ns.c zebra: fix heap-use-after free on ns shutdown 2024-10-16 14:49:50 +00:00
zebra_ns.h zebra: fix heap-use-after free on ns shutdown 2024-10-16 14:49:50 +00:00
zebra_opaque.c zebra: clean up coverity warning in opaque api 2023-06-26 13:19:23 -04:00
zebra_opaque.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_pbr.c *: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ 2023-11-21 08:08:29 -05:00
zebra_pbr.h *: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ 2023-11-21 08:08:29 -05:00
zebra_ptm_redistribute.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_ptm_redistribute.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_ptm.c zebra: convert to mgmtd 2024-01-28 23:28:40 +02:00
zebra_ptm.h zebra: convert to mgmtd 2024-01-28 23:28:40 +02:00
zebra_pw.c zebra: Fix crash in pw code 2024-10-09 18:49:06 +00:00
zebra_pw.h zebra: Move pw status settting until after we get results 2024-10-07 20:36:45 -04:00
zebra_rib.c zebra: Move pw status settting until after we get results 2024-10-07 20:36:45 -04:00
zebra_rnh.c zebra: include the prefix in nht show command 2024-09-14 23:47:00 -07:00
zebra_rnh.h zebra: include route source set by route-map in show output 2024-05-14 10:28:17 -04:00
zebra_routemap_nb_config.c *: Add missing SPDX-License-Identifier for some .c/.h files 2024-03-21 16:46:58 +02:00
zebra_routemap_nb.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_routemap_nb.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_routemap.c bgpd: Show which AFI is affected when prefix-list is not found 2024-07-31 13:20:59 +03:00
zebra_routemap.h zebra: convert vrf configuration output to NB 2024-01-28 23:28:40 +02:00
zebra_router.c zebra: Ensure we cannot send invalid range to kernel 2024-08-21 10:15:55 -04:00
zebra_router.h *: Add and use option for graceful (re)start 2024-07-01 13:02:52 -07:00
zebra_script.c zebra: Add code to set SRv6 encap source addr in dplane 2023-12-14 14:56:44 +01:00
zebra_script.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_snmp.c zebra: Add missing proto translations 2024-09-25 12:14:50 -04:00
zebra_srte.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_srte.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_srv6_vty.c zebra: Fix compilation warning 2024-08-18 13:03:04 +02:00
zebra_srv6_vty.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
zebra_srv6.c zebra: Remove duplicate #include <stdio.h> 2024-07-24 23:39:34 +02:00
zebra_srv6.h zebra: Alloc/Release SIDs to daemons upon request 2024-06-13 14:54:16 +02:00
zebra_tc.c zebra: Set Free Functions for Traffic Control Hash Tables 2023-11-29 16:33:54 +04:00
zebra_tc.h zebra: Set Free Functions for Traffic Control Hash Tables 2023-11-29 16:33:54 +04:00
zebra_trace.c *: Add missing SPDX-License-Identifier for some .c/.h files 2024-03-21 16:46:58 +02:00
zebra_trace.h zebra: remove unused function from if_netlink.c 2024-10-06 19:25:44 -04:00
zebra_vrf.c zebra: convert to mgmtd 2024-01-28 23:28:40 +02:00
zebra_vrf.h zebra: add 'mpls fec nexthop-resolution' command to vtysh 2024-06-07 12:33:47 +02:00
zebra_vty.c lib, zebra: TABLE_NODE is not used 2024-09-24 16:05:54 -04:00
zebra_vxlan_if.c zebra: changes for code maintainability 2024-07-15 19:13:47 +05:30
zebra_vxlan_if.h zebra: Fix for mcast-group update and delete per vni for svd 2023-02-13 18:12:05 -05:00
zebra_vxlan_private.h Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
zebra_vxlan.c zebra: evpn: not coerce VTEP IP to IPv4 in nh_list 2024-07-08 10:32:03 +02:00
zebra_vxlan.h zebra: fix vni NB conversion 2024-01-28 23:28:40 +02:00
zserv.c zebra: Add more vrf name to debugs 2024-09-11 15:30:43 -04:00
zserv.h *: Add and use option for graceful (re)start 2024-07-01 13:02:52 -07:00