-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
Check MACH_PORT_VALID on return from pthread_mach_thread_np #3520
base: main
Are you sure you want to change the base?
Conversation
pthread_mach_thread_np can return invalid values so check for those and return nullptr from ThreadHandle
6990048
to
b656bde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@indragiek, good catch 👍 . CI is broken, and it would be great to add or change some tests for these changes if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the logic again in SentryBacktrace.cpp which contains the callsite for the function we've modified is a bit unclear to me, given the name allExcludingCurrent
. Reading it starting at the loop, it looks like we're going to do work on all the other threads except the current one, which is true, but we do still have to retain the current thread in order to know what thread we're running on, and the callsite tells me we threw out that info when we actually didn't.
TL;DR I would propose we rename allExcludingCurrent
to currentAndOtherThreads
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have some tests, I will approve this PR. The rest LGTM.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3520 +/- ##
=============================================
+ Coverage 89.241% 91.165% +1.923%
=============================================
Files 529 609 +80
Lines 57780 47846 -9934
Branches 20687 0 -20687
=============================================
- Hits 51564 43619 -7945
+ Misses 5300 4227 -1073
+ Partials 916 0 -916
... and 607 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
52e4912 | 1216.25 ms | 1226.69 ms | 10.44 ms |
742d4b6 | 1230.41 ms | 1247.23 ms | 16.83 ms |
297f460 | 1234.81 ms | 1255.27 ms | 20.45 ms |
becc941 | 1221.90 ms | 1240.37 ms | 18.47 ms |
340fb46 | 1224.60 ms | 1239.27 ms | 14.67 ms |
3297d6e | 1195.69 ms | 1212.35 ms | 16.65 ms |
0d32275 | 1215.31 ms | 1240.19 ms | 24.88 ms |
4d3df92 | 1218.27 ms | 1248.30 ms | 30.03 ms |
b15521e | 1224.44 ms | 1251.13 ms | 26.68 ms |
e5dcbd5 | 1223.47 ms | 1243.90 ms | 20.43 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
52e4912 | 21.58 KiB | 418.14 KiB | 396.56 KiB |
742d4b6 | 21.58 KiB | 546.20 KiB | 524.62 KiB |
297f460 | 21.58 KiB | 629.83 KiB | 608.24 KiB |
becc941 | 21.58 KiB | 419.82 KiB | 398.24 KiB |
340fb46 | 21.58 KiB | 418.78 KiB | 397.20 KiB |
3297d6e | 21.58 KiB | 418.44 KiB | 396.86 KiB |
0d32275 | 22.84 KiB | 403.14 KiB | 380.29 KiB |
4d3df92 | 22.85 KiB | 413.45 KiB | 390.60 KiB |
b15521e | 21.58 KiB | 573.18 KiB | 551.60 KiB |
e5dcbd5 | 22.85 KiB | 414.09 KiB | 391.24 KiB |
@armcknight, I guess after resolving the conflicts, I can review this? |
📜 Description
pthread_mach_thread_np
can return invalid values so check for those and return nullptr fromThreadHandle
. That means changing the call sites forThreadHandle::current()
to check for a null pointer value.💡 Motivation and Context
We don't have a solid repro for #3354 but this is one of the potential causes. In any case it doesn't hurt to add the check.
💚 How did you test it?
Run tests
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps