Hello!

On Thu, Nov 12, 2026 at 02:25:04AM -0300, Marcelo Balbinot wrote:

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.

This is impressive load actually.

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 },

This is indeed fishy.

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.

That’s korrekt.

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).

This seems to be a reasonable fix, yes. I spent some time checking that the REF_OBSOLETE flag is actually stopping all readers from continuing, otherwise we would have another, even smaller race condition window, just before the sentinel structure gets reused.

Also, this whole sentinel mechanism is about to be removed for 3.5.0, but it’s present back into 3.1.x; we’ll backport the patch all the way back there.

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).

I’m not running that, I agree with the analysis, the bug is obvious once pointed at.

We are reporting this privately

You are in the list but it doesn’t matter in this case imho.

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.

I’m quite convinced that if a BGP peer is able to flap prefixes covering your next hops from outside your AS, there is something wrong in your setup, and therefore this is “just a bug” but I may be wrong.

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.

Thanks for that, we appreciate your openness. There is probably no need for more data at all.

Thank you for your report and patch, this helped. It is also possible that this was the actual case for various other crashes, as it was theoretically possible to read random memory in corner cases.

Happy routing!

–
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.