Skip to content

[5.9][Concurrency] Fix crash when actor is dynamically subclassed. #67682

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

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Aug 2, 2023

Cherry-pick #67681 to release/5.9.

Dynamic subclasses have a NULL type descriptor. Make sure isDefaultActorClass doesn't try to dereference that NULL descriptor.

rdar://112223265

@mikeash mikeash requested a review from a team as a code owner August 2, 2023 20:33
@mikeash
Copy link
Contributor Author

mikeash commented Aug 2, 2023

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Aug 2, 2023

@swift-ci please test windows platform

@mikeash
Copy link
Contributor Author

mikeash commented Aug 2, 2023

• Description: Using ObjC runtime APIs to dynamically subclass an actor results in NULL dereference crashes in the concurrency runtime. Swift runtime code checks for dynamic subclasses and skips over them, but this was missing from the isDefaultActorClass concurrency runtime function.
• Risk: Low. The fixed code skips dynamic subclasses and continues looking up the superclass chain. Normal classes are treated just as they were previously.
• Original PR: #67681
• Reviewed By: Kavon Farvardin
• Testing: A test was added to ensure that dynamically subclassed actors work.
• Resolves: rdar://112223265

@mikeash
Copy link
Contributor Author

mikeash commented Aug 2, 2023

@swift-ci please test windows platform

1 similar comment
@mikeash
Copy link
Contributor Author

mikeash commented Aug 2, 2023

@swift-ci please test windows platform

Dynamic subclasses have a NULL type descriptor. Make sure isDefaultActorClass doesn't try to dereference that NULL descriptor.

rdar://112223265
(cherry picked from commit e5303b8)
@mikeash mikeash force-pushed the fix-actor-dynamic-subclassing-5.9 branch from 0986ec1 to 3de357b Compare August 2, 2023 23:05
@mikeash
Copy link
Contributor Author

mikeash commented Aug 2, 2023

@swift-ci please test

2 similar comments
@mikeash
Copy link
Contributor Author

mikeash commented Aug 3, 2023

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Aug 3, 2023

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Aug 3, 2023

@swift-ci please test windows platform

@mikeash mikeash merged commit 1a9bf7e into swiftlang:release/5.9 Aug 3, 2023
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