You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello fellow Rustacean,
we (Rust group @sslab-gatech) are scanning Rust code on crates.io for potential memory safety and soundness bugs and found an issue in this crate which allows safe Rust code to exhibit an undefined behavior.
EventQueueRef::push(receiver, event) can be called on a queue that is not associated with the receiver. This allows ToReceive event to run before Initialize event and makes receiver's handler to access an uninitialized variable. A data race is also possible because two event queues can modify the same state concurrently.
// [1] We know the value won't be touched before initialization: the first
// message received by the remote pointer is the initialization request.
// This is because messages are processed in order in the queue. That is
// why (among other things) posting a message directly to a remote
// actor is unsafe.
// [2] We know the actor won't be dropped before initialization: the
// initialization request message holds a copy of the remote.
data:MaybeUninit::uninit().assume_init()
This part of the code also needs a fix. Storing uninitialized memory to certain types is always unsound no matter whether it is touched or not. From MaybeUninit's Initialization invariant section:
As a consequence, zero-initializing a variable of reference type causes instantaneous undefined behavior, no matter whether that reference ever gets used to access memory
Reproduction
Below is an example program that accesses uninitialized memory using safe APIs of bottle.
thread '<unnamed>' panicked at 'Uninitialized value access! 0x55a0a558d680', src/main.rs:47:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Future timeout
Return code 0
Hello fellow Rustacean,
we (Rust group @sslab-gatech) are scanning Rust code on crates.io for potential memory safety and soundness bugs and found an issue in this crate which allows safe Rust code to exhibit an undefined behavior.
Issue Description
bottle/src/queue.rs
Lines 64 to 76 in c3d6ccb
EventQueueRef::push(receiver, event)
can be called on a queue that is not associated with thereceiver
. This allowsToReceive
event to run beforeInitialize
event and makesreceiver
's handler to access an uninitialized variable. A data race is also possible because two event queues can modify the same state concurrently.bottle/src/remote.rs
Lines 69 to 77 in c3d6ccb
This part of the code also needs a fix. Storing uninitialized memory to certain types is always unsound no matter whether it is touched or not. From MaybeUninit's Initialization invariant section:
Reproduction
Below is an example program that accesses uninitialized memory using safe APIs of
bottle
.Show Detail
Output:
Tested Environment
async-std = { version = "1.7.0", features = ["attributes"] }
The text was updated successfully, but these errors were encountered: