Skip to content

[Backtracing][Linux] Properly align the stacks. #66627

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

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

al45tair
Copy link
Contributor

We have two stacks that we set up during crash handling, both of which were potentially misaligned. This only tripped us up on Ubuntu 20.04 on aarch64 - my guess is that maybe clone() aligns the stack pointer on newer kernels which is why we didn't see it on 22.04.

rdar://110743884

We have two stacks that we set up during crash handling, both of
which were potentially misaligned.  This only tripped us up on
Ubuntu 20.04 on aarch64 - my guess is that maybe `clone()` aligns
the stack pointer on newer kernels which is why we didn't see it
on 22.04.

rdar://110743884
@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels Jun 14, 2023
@al45tair al45tair requested a review from a team as a code owner June 14, 2023 12:47
@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair
Copy link
Contributor Author

al45tair commented Jun 14, 2023

Explanation: When handling a crash, we create a background thread and a new process; both of these require us to allocate space for a stack, which we were doing, but we weren't specifying any alignment on the buffers used for that. This didn't work on Ubuntu 20.04 on aarch64, presumably because the kernel on that version doesn't round down the stack pointer in case it's misaligned.
Risk: Low. Only affects Linux.
Original PR: #66626
Reviewed by: @mikeash
Resolves: rdar://110743884
Tests: This fixes a build failure in CI. After merging, the relevant tests should start working reliably.

@al45tair al45tair merged commit f34ed8a into swiftlang:release/5.9 Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants