forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 352
Increase the Entropy of ModuleManager Map Keys #1651
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
CodaFi
merged 1 commit into
swiftlang:apple/stable/20200108
from
CodaFi:i-node-what-you-did-last-summer
Aug 19, 2020
Merged
Increase the Entropy of ModuleManager Map Keys #1651
CodaFi
merged 1 commit into
swiftlang:apple/stable/20200108
from
CodaFi:i-node-what-you-did-last-summer
Aug 19, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
|
@swift-ci test |
DougGregor
approved these changes
Aug 14, 2020
50a22c0 to
826f98b
Compare
Author
|
@swift-ci test |
|
@CodaFi Swift/master branch only accepts LLDB changes. Please merge your PR into |
826f98b to
033e3c3
Compare
Author
Author
|
@swift-ci test macOS |
966bb8c to
7439c0a
Compare
Author
|
@swift-ci test |
fbdf248 to
09556af
Compare
Author
|
@swift-ci test |
09556af to
603e9bb
Compare
603e9bb to
3e16fc3
Compare
The ModuleManager's use of FileEntry nodes as the keys for its map of loaded modules is less than ideal. Uniqueness for FileEntry nodes is maintained by FileManager, which in turn uses inode numbers on hosts that support that. When coupled with the module cache's proclivity for turning over and deleting stale PCMs, this means entries for different module files can wind up reusing the same underlying inode. When this happens, subsequent accesses to the Modules map will disagree on the ModuleFile associated with a given file. It's fine to use the file management utilities to guarantee the presence of module data, but we need a better source of key material that is invariant with respect to these OS-level details. Using file paths alone is a similarly frought solution because the ASTWriter performs a custom canonicalization step (that is not equivalent to path canonicalization) that renders keys from loaded AST cores useless for looking up cached entries. To mitigate the effects of inode reuse, increase the entropy of the key material by incorporating the modtime and size. This ultimately decreases the likelihood that a PCM that is swapped on disk will confuse the cache, but it does not eliminate the possibility of collisions. rdar://48443680
Author
|
@swift-ci test |
Author
|
⛵ |
CodaFi
added a commit
to CodaFi/swift-package-manager
that referenced
this pull request
Aug 19, 2020
After swiftlang/llvm-project#1651, we should see no remaining issues from this test.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ModuleManager's use of FileEntry nodes as the keys for its map of
loaded modules is less than ideal. Uniqueness for FileEntry nodes is
maintained by FileManager, which in turn uses inode numbers on hosts
that support that. When coupled with the module cache's proclivity for
turning over and deleting stale PCMs, this means entries for different
module files can wind up reusing the same underlying inode. When this
happens, subsequent accesses to the Modules map will disagree on the
ModuleFile associated with a given file.
It's fine to use the file management utilities to guarantee the presence
of module data, but we need a better source of key material that is
invariant with respect to these OS-level details. Using file paths alone
is a similarly frought solution because the ASTWriter performs a custom
canonicalization step (that is not equivalent to path canonicalization)
that renders keys from loaded AST cores useless for looking up cached
entries.
To mitigate the effects of inode reuse, increase the entropy of the key
material by incorporating the modtime and size. This ultimately
decreases the likelihood that a PCM that is swapped on disk will confuse
the cache, but it does not eliminate the possibility of collisions.
rdar://48443680