-
Notifications
You must be signed in to change notification settings - Fork 165
fix: Avoid double free of stack data #3209
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3209 +/- ##
============================================
- Coverage 76.46% 6.81% -69.65%
Complexity 2927 2927
============================================
Files 141 114 -27
Lines 16025 11582 -4443
Branches 1107 0 -1107
============================================
- Hits 12253 789 -11464
- Misses 3197 10793 +7596
+ Partials 575 0 -575
Flags with carried forward coverage won't be shown. Click here to find out more. see 112 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
That might mitigate a problem a little, but the actual problem is that there are two writers (two threads). There should be only ever one single coms writer. |
@bwoebi Sorry, there is no two. It's just a duplicated command issue.('backtrace' and 'thread apply all bt') |
Oh, I see, I'm blind then - thanks! Looking again. |
Hi @bwoebi, |
@bwoebi |
Hi @bwoebi , |
Hey @junjihashimoto if you search for "package extension" in the CI artifacts, you'll get it's artifacts. What you'll want is the datadog-setup.php from the artifact list. |
But the problem with your patch is that it may just mitigate the issue - ultimately an use-after-free may just segfault. If stack is freed, accessing stack->data is not allowed. |
@bwoebi BTW, I can not see the artifact list in the artifact tab of circle ci. Am I looking in the wrong place? |
Hey there @junjihashimoto, build artifacts are removed from storage after 7 days. I restarted that job for you at https://app.circleci.com/pipelines/github/DataDog/dd-trace-php/20558/workflows/71d751ac-61ea-4353-8ffd-7aec794284be so you can check this CI later for the build artifacts. |
@realFlowControl
|
Description
#3208
A double free may be occurring in ext/coms.
The cause of this seems to be that ownership of the stack is shared between the writer and the main thread, and it is suspected that the writer is freeing things that have been freed by other threads.
In this PR, we will avoid double frees by putting NULL into data for things that have been freed once, and checking this.
It's not a perfect fix, but it should avoid double frees.
Reviewer checklist