Skip to content

Conversation

raja-rajasekar
Copy link
Contributor

RB tree for router table is not initializes and can have garbage values leading to crashes when zebra boots.

==52257== Invalid read of size 4
==52257==    at 0x24A683: zebra_router_table_entry_compare (zebra_router.c:46)
==52257==    by 0x24A683: zebra_router_table_head_RB_COMPARE (zebra_router.c:38)
==52257==    by 0x494859F: _rb_find (openbsd-tree.c:415)
==52257==    by 0x24AA44: zebra_router_table_head_RB_FIND (zebra_router.h:39)
==52257==    by 0x24AA44: zebra_router_get_table (zebra_router.c:131)
==52257==    by 0x268AB8: zebra_vrf_table_create (zebra_vrf.c:432)
==52257==    by 0x268AB8: zebra_vrf_enable (zebra_vrf.c:140)
==52257==    by 0x4977036: vrf_enable (vrf.c:286)
==52257==    by 0x4977036: vrf_enable (vrf.c:275)
==52257==    by 0x497797D: vrf_init (vrf.c:554)
==52257==    by 0x269854: zebra_vrf_init (zebra_vrf.c:645)
==52257==    by 0x237315: zebra_ns_init (zebra_ns.c:252)
==52257==    by 0x1BF284: main (main.c:469)
==52257==  Address 0x56415741e5894875 is not stack'd, malloc'd or (recently) free'd
==52257==
==52257==
==52257== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==52257==    at 0x4D07EEC: __pthread_kill_implementation (pthread_kill.c:44)
==52257==    by 0x4CB8FB1: raise (raise.c:26)
==52257==    by 0x4961BFB: core_handler (sigevent.c:261)
==52257==    by 0x4CB904F: ??? (in /usr/lib/x86_64-linux-gnu/libc.so.6)
==52257==    by 0x24A682: zebra_router_table_entry_compare (zebra_router.c:46)
==52257==    by 0x24A682: zebra_router_table_head_RB_COMPARE (zebra_router.c:38)
==52257==    by 0x494859F: _rb_find (openbsd-tree.c:415)
==52257==    by 0x24AA44: zebra_router_table_head_RB_FIND (zebra_router.h:39)
==52257==    by 0x24AA44: zebra_router_get_table (zebra_router.c:131)
==52257==    by 0x268AB8: zebra_vrf_table_create (zebra_vrf.c:432)
==52257==    by 0x268AB8: zebra_vrf_enable (zebra_vrf.c:140)
==52257==    by 0x4977036: vrf_enable (vrf.c:286)
==52257==    by 0x4977036: vrf_enable (vrf.c:275)
==52257==    by 0x497797D: vrf_init (vrf.c:554)
==52257==    by 0x269854: zebra_vrf_init (zebra_vrf.c:645)
==52257==    by 0x237315: zebra_ns_init (zebra_ns.c:252)
==52257==

Ticket :#4502759

RB tree for router table is not initializes and can have garbage values
leading to crashes when zebra boots.

==52257== Invalid read of size 4
==52257==    at 0x24A683: zebra_router_table_entry_compare (zebra_router.c:46)
==52257==    by 0x24A683: zebra_router_table_head_RB_COMPARE (zebra_router.c:38)
==52257==    by 0x494859F: _rb_find (openbsd-tree.c:415)
==52257==    by 0x24AA44: zebra_router_table_head_RB_FIND (zebra_router.h:39)
==52257==    by 0x24AA44: zebra_router_get_table (zebra_router.c:131)
==52257==    by 0x268AB8: zebra_vrf_table_create (zebra_vrf.c:432)
==52257==    by 0x268AB8: zebra_vrf_enable (zebra_vrf.c:140)
==52257==    by 0x4977036: vrf_enable (vrf.c:286)
==52257==    by 0x4977036: vrf_enable (vrf.c:275)
==52257==    by 0x497797D: vrf_init (vrf.c:554)
==52257==    by 0x269854: zebra_vrf_init (zebra_vrf.c:645)
==52257==    by 0x237315: zebra_ns_init (zebra_ns.c:252)
==52257==    by 0x1BF284: main (main.c:469)
==52257==  Address 0x56415741e5894875 is not stack'd, malloc'd or (recently) free'd
==52257==
==52257==
==52257== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==52257==    at 0x4D07EEC: __pthread_kill_implementation (pthread_kill.c:44)
==52257==    by 0x4CB8FB1: raise (raise.c:26)
==52257==    by 0x4961BFB: core_handler (sigevent.c:261)
==52257==    by 0x4CB904F: ??? (in /usr/lib/x86_64-linux-gnu/libc.so.6)
==52257==    by 0x24A682: zebra_router_table_entry_compare (zebra_router.c:46)
==52257==    by 0x24A682: zebra_router_table_head_RB_COMPARE (zebra_router.c:38)
==52257==    by 0x494859F: _rb_find (openbsd-tree.c:415)
==52257==    by 0x24AA44: zebra_router_table_head_RB_FIND (zebra_router.h:39)
==52257==    by 0x24AA44: zebra_router_get_table (zebra_router.c:131)
==52257==    by 0x268AB8: zebra_vrf_table_create (zebra_vrf.c:432)
==52257==    by 0x268AB8: zebra_vrf_enable (zebra_vrf.c:140)
==52257==    by 0x4977036: vrf_enable (vrf.c:286)
==52257==    by 0x4977036: vrf_enable (vrf.c:275)
==52257==    by 0x497797D: vrf_init (vrf.c:554)
==52257==    by 0x269854: zebra_vrf_init (zebra_vrf.c:645)
==52257==    by 0x237315: zebra_ns_init (zebra_ns.c:252)
==52257==

Ticket :#4502759

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ton31337
Copy link
Member

@Mergifyio backport dev/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0

Copy link

mergify bot commented Jun 19, 2025

backport dev/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0

✅ Backports have been created

@ton31337 ton31337 merged commit d78ff94 into FRRouting:master Jun 20, 2025
16 checks passed
ton31337 added a commit that referenced this pull request Jun 20, 2025
zebra: Initialize RB tree for router tables (backport #19049)
ton31337 added a commit that referenced this pull request Jun 20, 2025
zebra: Initialize RB tree for router tables (backport #19049)
ton31337 added a commit to opensourcerouting/frr that referenced this pull request Aug 2, 2025
* bgpd: correct no form commands (backport FRRouting#18911)
* bgpd: fix to show exist/non-exist-map in 'show run' properly FRRouting#18853
* redhat: make FRR RPM build to work on RedHat 10 (backport FRRouting#18920)
* build: check for libunwind.h, not unwind.h (backport FRRouting#18912)
* bgpd: use AS4B format for BGP loc-rib messages. (backport FRRouting#18936)
* bgpd: fix for the validity and the presence of prefixes in the BGP VPN table. (backport FRRouting#17370)
* bgpd: Force adj-rib-out updates if MRAI is kicked in (backport FRRouting#18959)
* zebra: Provide SID value when sending SRv6 SID release notify message (backport FRRouting#18971)
* bgpd: Fix crash when fetching statistics for bgp instance (backport FRRouting#19003)
* nhrpd: fix crash when accessing invalid memory zone (backport FRRouting#18994)
* zebra: Initialize RB tree for router tables (backport FRRouting#19049)
* zebra: fix null pointer dereference in zebra_evpn_sync_neigh_del (backport FRRouting#19054)
* zebra: fix stale NHG in kernel (backport FRRouting#18899)
* bgpd: Fix incorrect stripping of transitive extended communities (backport FRRouting#19065)
* lib: Fix no on-match goto NUM command (backport FRRouting#19108)
* bgpd: Fix extended community check for IP non-transitive type (backport FRRouting#19097)
* bgpd: Fix DEREF_OF_NULL.EX.COND in bgp_updgrp_packet (backport FRRouting#19126)
* lib: revert addition of vtysh_flush() call in vty_out() (backport FRRouting#19109)
* bgpd: Extract link bandwidth value from extcommunity before using for WCMP (backport FRRouting#19165)
* Use ipv4 class E addresses (240.0.0.0/4) as connected routes by default (backport FRRouting#18095)
* bfdd: Set bfd.LocalDiag when transitioning to AdminDown (backport FRRouting#18592)
* zebra: clean up a json object leak (backport FRRouting#19192)
* bgpd: Do not try to reuse freed route-maps (backport FRRouting#19191)
* lib: fix routemap crash (backport FRRouting#19127)
* bgpd: initialize local variable (backport FRRouting#19233)
* ospfd: Use after free cleanup of lsa (backport FRRouting#19224)
* vtysh: copy config from file should actually apply (backport FRRouting#19242)
* bgpd : Fix compilation error in bgpd module: Update TP_ARGS for bgp (backport FRRouting#19266)
* bgpd: Ensure addpath does not withdraw selected route in some situations (backport FRRouting#19210)
* lib, zebra: mark singleton nexthops inactive/active on link state changes for wecmp (backport FRRouting#18947)
* eigrp: validate hello packets and tlvs better (backport FRRouting#19251)
* bgpd: [GR] fixed selectionDeferralTimer to display select_defer_time val FRRouting#19283

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants