-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
ci: Enable UBSan for 'longlong' builds in CI, add stack size for sanitizer builds. #17735
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
3b2a4a8
to
008b8c5
Compare
I'm confused why the stack changes are needed here:
// ensure there is enough stack to include a stack-overflow margin
if (*stack_size < 2 * THREAD_STACK_OVERFLOW_MARGIN) {
*stack_size = 2 * THREAD_STACK_OVERFLOW_MARGIN;
} which is 16k, so I don't think the change to // adjust stack_size to provide room to recover from hitting the limit
*stack_size -= THREAD_STACK_OVERFLOW_MARGIN; and that's already 8k, so I don't think It's a bit hard to follow the logic of the stack limit for threads. So maybe we should either get rid of |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17735 +/- ##
=========================================
Coverage ? 98.38%
=========================================
Files ? 171
Lines ? 22283
Branches ? 0
=========================================
Hits ? 21924
Misses ? 359
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code size report:
|
This PR with the cherry-picked commit also hit "RuntimeError: maximum recursion depth exceeded" when testing longlong+UBSan, so you're right that it's not the right fix for this case.
Seems reasonable, I'll have a look along these lines. |
So maybe there just needs to be more stack overall, rather than a change in stack margin? Maybe |
1dc48bf
to
818de93
Compare
Also rewrite the sanitizer argument variables to not assume a variant. longlong variant currently fails in this config, due to a bug fixed in follow-up commit. Signed-off-by: Angus Gratton <angus@redyak.com.au>
818de93
to
0e9f163
Compare
Clang and gcc>=14 can use __has_feature() to detect if a sanitizer is enabled, but older GCC has no mechanism - need to set a macro explicitly for this to be recognised. Necessary for increasing some resource limits in sanitizer builds. Important not to use to avoid real issues! This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
f7b8aee
to
86ec523
Compare
b354b70
to
b176fef
Compare
Includes a refactor to apply the same stack size multipliers for the default thread stack size same as the main stack size. This goes in a new port-specific header as it depends on macros in misc.h, so can't be in mpconfigport.h. A side effect of this is that the default thread stack size is now doubled on ARM, same as the main stack size. This a fix for 'RuntimeError: maximum recursion depth exceeded' when running some tests under UBSan and/or ASan with some older GCC versions (observed on gcc 11.4 as used in CI). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Angus Gratton <angus@redyak.com.au>
Otherwise no exceptions are raised when doubling the stack size on unix ports with sanitizers enabled. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
b176fef
to
5b7135b
Compare
Summary
Testing
Trade-offs and Alternatives