Skip to content

DeadObjectAllocation: fix a use-after free crash #37127

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
Apr 30, 2021

Conversation

eeckstein
Copy link
Contributor

The optimization tried to optimized a keypath instruction which was already deleted in a previous iteration.

rdar://77180080

@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from atrick April 29, 2021 12:33
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

You're deliberately creating a data structure full of dangling pointers, whose memory may be reused? And not even commenting that the data structure holds dangling pointers?

The pattern used everywhere else is to use a deletion callback that either removes items from the allocations set or defers deletion.

The optimization tried to optimized a keypath instruction which was already deleted in a previous iteration.

rdar://77180080
@eeckstein eeckstein force-pushed the fix-deadobject-elim branch from a60ea38 to 5a76154 Compare April 29, 2021 16:59
@eeckstein
Copy link
Contributor Author

Both patterns don't work very well here (I don't want to go into details now).
But yeah, you are right, I was not super happy with this either.

I pushed a new version which I think is a more elegant solution.

@eeckstein
Copy link
Contributor Author

@swift-ci test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

LGTM

@eeckstein eeckstein merged commit 776c8ed into swiftlang:main Apr 30, 2021
@eeckstein eeckstein deleted the fix-deadobject-elim branch April 30, 2021 04:33
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