Skip to content

[5.8][Runtime] Fix swift_weakTakeStrong(). #65857

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
May 18, 2023

Conversation

al45tair
Copy link
Contributor

It turns out that when taking the last weak reference for an object that has been deallocated, we might have returned a non-null pointer when we shouldn't have. Which is exciting.

rdar://106375185, rdar://109151498

It turns out that when taking the last weak reference for an object that
has been deallocated, we might have returned a non-null pointer when we
shouldn't have.  Which is exciting.

rdar://106375185
@al45tair al45tair requested a review from a team as a code owner May 11, 2023 10:36
@al45tair
Copy link
Contributor Author

Explanation: Fixes a potential source of UAF bugs.
Risk: Low. Only affects swift_weakTakeStrong(), which thankfully seems to be called very rarely.
Original PR: #65192
Reviewed by: @mikeash
Resolves: rdar://109151498 (original resolved rdar://106375185)
Tests: This is causing runtime/LongTests/SwiftRuntimeLongTests/LongRefcountingTest/lifecycle_live_deiniting_deinited_freed_with_side_DeathTest to fail.

@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.8 labels May 11, 2023
@al45tair al45tair changed the title [Runtime] Fix swift_weakTakeStrong(). [5.8][Runtime] Fix swift_weakTakeStrong(). May 11, 2023
@airspeedswift airspeedswift merged commit f1d2768 into swiftlang:release/5.8 May 18, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants