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
implement Send for all types T. However, this should probably be bounded by T: Send, otherwise it allows smuggling non-Send types across thread boundaries. Here's an example of a data race with Rcs that segfaults safe Rust code:
#![forbid(unsafe_code)]use ticketed_lock::TicketedLock;use futures::Future;use std::{rc::Rc, thread};fnmain(){let rc = Rc::new(());let rc_clone = rc.clone();letmut lock = TicketedLock::new(rc_clone);let read_ticket = lock.read();
thread::spawn(move || {let smuggled_rc = read_ticket.wait().unwrap();println!("Thread: {:p}",*smuggled_rc);// Race the refcount with the main thread.for _ in0..100_000_000{
smuggled_rc.clone();}});println!("Main: {:p}", rc);for _ in0..100_000_000{
rc.clone();}}
Hi there, we (Rust group @sslab-gatech) are scanning crates on crates.io for potential soundness bugs. We noticed that
ReadTicket
ticketed_lock/src/lib.rs
Line 53 in 6d85af9
and
WriteTicket
ticketed_lock/src/lib.rs
Line 115 in 6d85af9
implement
Send
for all typesT
. However, this should probably be bounded byT: Send
, otherwise it allows smuggling non-Send types across thread boundaries. Here's an example of a data race withRc
s that segfaults safe Rust code:This outputs:
The text was updated successfully, but these errors were encountered: