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

hotfix/fix use-after-free caused by cancelled service tracker. #596

Merged

Conversation

PengZheng
Copy link
Contributor

@PengZheng PengZheng commented Jul 26, 2023

This PR fixes #595, a use-after-free introduced by a previous attempt to avoid deadlock, by splitting the creation of a service tracker into two steps:

  1. Create a closed service tracker if not cancelled under the protection of ctx->mutex
  2. Open the tracker without holding ctx->mutex (no risk of deadlock).

@PengZheng PengZheng linked an issue Jul 26, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2023

Codecov Report

Merging #596 (e5a0a37) into master (456de19) will decrease coverage by 0.48%.
The diff coverage is 80.76%.

❗ Current head e5a0a37 differs from pull request most recent head 7c65bfc. Consider uploading reports for the commit 7c65bfc to get more accurate results

@@            Coverage Diff             @@
##           master     #596      +/-   ##
==========================================
- Coverage   79.00%   78.52%   -0.48%     
==========================================
  Files         234      234              
  Lines       35386    35389       +3     
==========================================
- Hits        27955    27790     -165     
- Misses       7431     7599     +168     
Files Changed Coverage Δ
libs/framework/src/service_tracker.c 77.70% <75.00%> (+0.07%) ⬆️
libs/framework/src/bundle_context.c 80.53% <88.88%> (+0.17%) ⬆️
...iscovery_zeroconf/src/discovery_zeroconf_watcher.c 88.51% <100.00%> (-0.04%) ⬇️

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@pnoltes pnoltes left a comment

Choose a reason for hiding this comment

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

LGTM

@PengZheng PengZheng merged commit d214522 into master Jul 26, 2023
16 checks passed
@PengZheng PengZheng deleted the hotfix/595-use-after-free-caused-by-cancelled-tracker branch July 26, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use-after-free caused by cancelled tracker
3 participants