mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/master' into master-rebranch
This commit is contained in:
@@ -348,8 +348,25 @@ std::error_code SerializedModuleLoaderBase::openModuleFile(
|
||||
}
|
||||
|
||||
// Actually load the file and error out if necessary.
|
||||
//
|
||||
// Use the default arguments except for IsVolatile. Force avoiding the use of
|
||||
// mmap to workaround issues on NFS when the swiftmodule file loaded changes
|
||||
// on disk while it's in use.
|
||||
//
|
||||
// In practice, a swiftmodule file can chane when a client uses a
|
||||
// swiftmodule file from a framework while the framework is recompiled and
|
||||
// installed over existing files. Or when many processes rebuild the same
|
||||
// module interface.
|
||||
//
|
||||
// We have seen these scenarios leading to deserialization errors that on
|
||||
// the surface look like memory corruption.
|
||||
//
|
||||
// rdar://63755989
|
||||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ModuleOrErr =
|
||||
FS.getBufferForFile(ModulePath);
|
||||
FS.getBufferForFile(ModulePath,
|
||||
/*FileSize=*/-1,
|
||||
/*RequiresNullTerminator=*/true,
|
||||
/*IsVolatile=*/true);
|
||||
if (!ModuleOrErr)
|
||||
return ModuleOrErr.getError();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user