Hello,
We run BIRD 3.3.2 as a route reflector / route server. It has ~2,700 BGP
sessions (iBGP rr clients and eBGP multihop), threads 20, and no IGP: only BGP
and static reject routes. It crashed about once a week; we have 12 cores
between August and November.
Most cores are SIGSEGV in the export of a feed to a BGP channel:
- rt_export_release() at rt-export.c:200, because feed->ni was built from
net == NULL (fault address 0xfffffffffffffff4);
- bgp_preexport() -> bgp_rte_proto(), because the exported rte has
src == NULL.
Both come from channel_notify_optimal_req() with RT_EXPORT_FEED.
In the complete cores, feed->block[0] is either all zeros or exactly
{ flags = REF_OBSOLETE, everything else zero }, i.e. an image of the spinlock
sentinel. rte_recalculate() keeps its sentinel in a _Thread_local static, but
rt_next_hop_update_net() keeps it on the stack. A lockless reader
(rt_feed_net_best()) can load n->routes == &sentinel, the writer then restores
n->routes and returns, and the reader checks REF_OBSOLETE and copies a stack
frame that has already been reused.
The attached patch moves that sentinel to a _Thread_local static. It applies to
v3.3.2, v3.4.0 and current thread-next (68953fa).
Reproducer (attached): Docker on Debian 12 with v3.4.0. It uses a test-only
amplifier patch that only adds small sleeps around the race window; it is
identical in both builds.
- without the fix: 4 of 4 runs crash in bgp_preexport() within 24-102 s;
- with the fix: 4 of 4 runs survive (3 x 300 s, 1 x 180 s).
We are reporting this privately because the trigger is route churn received
over BGP: a peer flapping prefixes that cover next hops makes the next hop
update run far more often. Feel free to move it to the list if you don't
consider it a security issue.
Disclosure: I did the analysis with the help of an LLM (Claude). I checked the
cores, the code paths and the reproducer results myself, and I can share more
data from the cores.
Attachments:
- 0001-Table-Do-not-keep-the-next-hop-update-sentinel-on-st.patch
- reproducer.tar.gz (Dockerfile, build/run scripts, amplifier patch, results)
- core-analysis-sanitized.txt (backtraces and feed memory dumps from the cores)
Production status: running v3.4.0 with this patch since 2026-11-12.
Best regards,
Marcelo Balbinot