Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: avoid notify race between io and main pthreads #11926

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

mjstapp
Copy link
Contributor

@mjstapp mjstapp commented Sep 9, 2022

The "bgp_notify_" apis in bgp_packet.c generate a notification to a peer, usually during error handling. The io pthread wants to send notifications in a couple of cases during early received-packet validation - but the existing api interacts with the peer struct itself, and that's not safe across the two pthreads.

Add a new api for use by the io pthread, and adjust the main notify api so that it can avoid touching the peer struct.

Fixes: #11698

The "bgp_notify_" apis in bgp_packet.c generate a notification
to a peer, usually during error handling. The io pthread wants
to send notifications in a couple of cases during early
received-packet validation - but the existing api interacts
with the peer struct itself, and that's not safe.

Add a new api for use by the io pthread, and adjust the main
notify api so that it can avoid touching the peer struct.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
@frrbot frrbot bot added the bgp label Sep 9, 2022
@github-actions github-actions bot added the master label Sep 9, 2022
@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-7300/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@ton31337 ton31337 self-requested a review September 9, 2022 14:50
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 ton31337 merged commit c3c5f18 into FRRouting:master Sep 12, 2022
@mjstapp mjstapp deleted the fix_bgp_io_race branch November 10, 2022 19:37
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.

bgpd: A use-after-free bug due to race conditions in 2 threads.
3 participants