Skip to content

[Runtime] Add a NULL check to MetadataAllocator. #40139

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
Nov 15, 2021

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Nov 11, 2021

MetadataAllocator should never return NULL, but bugs or corruption could potentially make that happen. On the large path, switch from malloc to swift_slowAlloc, which aborts on failure. On the pool path, check for a NULL allocation pointer, and log a bunch of information about the allocation request and the allocator's current state.

rdar://84503396

MetadataAllocator should never return NULL, but bugs or corruption could potentially make that happen. On the large path, switch from malloc to swift_slowAlloc, which aborts on failure. On the pool path, check for a NULL allocation pointer, and log a bunch of information about the allocation request and the allocator's current state.

rdar://84503396
@mikeash mikeash requested a review from al45tair November 11, 2021 17:17
@mikeash
Copy link
Contributor Author

mikeash commented Nov 12, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 64f8bca

@mikeash
Copy link
Contributor Author

mikeash commented Nov 12, 2021

@swift-ci please test linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 64f8bca

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 64f8bca

@mikeash
Copy link
Contributor Author

mikeash commented Nov 15, 2021

@swift-ci please test

Copy link
Contributor

@al45tair al45tair left a comment

Choose a reason for hiding this comment

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

It might be nice to assert that alignment is a power of 2. Otherwise looks good to me.

@mikeash
Copy link
Contributor Author

mikeash commented Nov 15, 2021

The Windows test failure is unrelated, merging.

@mikeash mikeash merged commit 9a2f449 into swiftlang:main Nov 15, 2021
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