Skip to content

runtime: Fix overflow of swift_unownedRetain reference counts #11290

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

@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 - 3f2e1fb6525a28599d1841da8d0db95c13fb252e
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 - 3f2e1fb6525a28599d1841da8d0db95c13fb252e
Test requested by - @aschwaighofer

@aschwaighofer
Copy link
Contributor Author

Unrelated error:

/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/tools/swift-api-digester/swift-api-digester.cpp:1096:16: error: enumeration value 'Destructor' not handled in switch [-Werror,-Wswitch]

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@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 OS X Platform
Git Commit - 3f2e1fb6525a28599d1841da8d0db95c13fb252e
Test requested by - @aschwaighofer

@aschwaighofer aschwaighofer force-pushed the runtime_fix_unowned_retain_overflow branch 2 times, most recently from ebba3dc to 9a75101 Compare August 1, 2017 18:33
@swift-ci
Copy link
Contributor

swift-ci commented Aug 1, 2017

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

@aschwaighofer aschwaighofer force-pushed the runtime_fix_unowned_retain_overflow branch from 9a75101 to ada35ce Compare August 1, 2017 18:42
@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 OS X Platform
Git Commit - 3085fee884b615f2dece8d81587e88dbc4c8177a
Test requested by - @aschwaighofer

@swift-ci
Copy link
Contributor

swift-ci commented Aug 1, 2017

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

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thanks for the fix!

// Check overflow and use the side table on overflow.
if (newbits.getUnownedRefCount() != oldValue + inc)
return incrementUnownedSlow(inc);

// FIXME: overflow check?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: you should remove the FIXME (maybe in a follow-up commit)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I noticed it too. I am going to do it in a follow up.

@aschwaighofer aschwaighofer force-pushed the runtime_fix_unowned_retain_overflow branch from ada35ce to 684bbd6 Compare August 2, 2017 14:12
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 runtime_fix_unowned_retain_overflow branch from 684bbd6 to d8abd2f Compare August 2, 2017 14:13
@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 - ada35ce95ffeb8d93c112971a114ed1f9cc81691
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 - ada35ce95ffeb8d93c112971a114ed1f9cc81691
Test requested by - @aschwaighofer

@aschwaighofer aschwaighofer merged commit dbca173 into swiftlang:master 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.

3 participants