Skip to content

[4.0] runtime: Fix overflow of swift_unownedRetain reference counts #11293

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

Conversation

aschwaighofer
Copy link
Contributor

On 32bit platforms there are 7 bits reserved for the unowned retain count. This
makes overflow a likely scenario. Implement overflow into the side table.

rdar://33495003

• Explanation: Usage of unowned references cause a crash on 32bit if there are more than 127 unowned references to one object. This is because the current representation reserves 7 bits on 32bit platforms.

• Scope of Issue: A crash will happen on 32bit platforms if there are more than 127 unowned references to an object

• Origination: This bug was likely introduced when moving to the new reference count representation in swift 4

• Risk: Low. Only the implementation of unowned references was changed. Behavior should only change when overflow happens.

• Testing: A test case was added to the regression suite

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer aschwaighofer force-pushed the swift-4.0-branch-runtime_fix_unowned_retain_overflow branch from b668e25 to ccf486f Compare August 1, 2017 19:28
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 1, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - b668e2590e9089f8975ddf6927f5f287eb1bd3d1
Test requested by - @aschwaighofer

@swift-ci
Copy link
Contributor

swift-ci commented Aug 1, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - b668e2590e9089f8975ddf6927f5f287eb1bd3d1
Test requested by - @aschwaighofer

On 32bit platforms there are 7 bits reserved for the unowned retain count. This
makes overflow a likely scenario. Implement overflow into the side table.

rdar://33495003
@aschwaighofer aschwaighofer force-pushed the swift-4.0-branch-runtime_fix_unowned_retain_overflow branch from ccf486f to 8c0dead Compare August 2, 2017 14:08
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 2, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - ccf486f720b30c923bb47355805752e59d2d9f35
Test requested by - @aschwaighofer

@swift-ci
Copy link
Contributor

swift-ci commented Aug 2, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - ccf486f720b30c923bb47355805752e59d2d9f35
Test requested by - @aschwaighofer

@aschwaighofer aschwaighofer merged commit 4da8347 into swiftlang:swift-4.0-branch Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants