-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
ci: Enable UBSan for 'longlong' builds in CI, add stack margin 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
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>
Compiler sanitizers such as AddressSanitizer and UndefinedSanitizer inflate call frames and can trip MicroPython's C-stack overflow check. Define MICROPY_STACK_CHECK_MARGIN = 8192 when the relevant sanitizer macros are present, update the unix port config, docs, and the thread_stacksize test. Non-sanitizer builds are unchanged. Signed-off-by: Koudai Aono <koxudaxi@gmail.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #17735 +/- ##
=======================================
Coverage 98.41% 98.41%
=======================================
Files 171 171
Lines 22210 22210
=======================================
Hits 21857 21857
Misses 353 353 ☔ 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 |
Summary
Testing
Trade-offs and Alternatives