-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unsoundness in ImmediateIO and TransactionalIO, aka RUSTSEC-2020-…
…0152 aka #1. Unsafe impls of Sync for both of these structs are removed, and Send bounds are introduced where necessary to allow Sync to be properly deduced instead. The unsafe impls were introduced due to an incorrect analysis of why Sync was not being auto-deduced as expected for these structs. The removed comment explains the original flawed analysis, which attributed it to the presence of a struct member of type PhantomData<EI>, under the assumption that the only "real" value of type EI in the struct is ultimately inside an IOMutex that should bless it with Sync-ness regardless if EI is itself Sync. In fact, Sync was not being deduced due to the absence of a *Send* bound on the type EI, which is required for Expander<EI> to be Send, which is required for IOMutex<Expander<EI>> to be *Sync*. The presence of the PhantomData<EI> member turns out to be entirely irrelevant. The bug could theoretically result in a data race if either type is used with an EI that is not safe to send between threads. This is a breaking change due to the addition of a trait bound in the public API.
- Loading branch information
Showing
5 changed files
with
32 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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