-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
beef::Cow lacks a Sync bound on its Send trait allowing for data races #37
Comments
Great catch! |
ammaraskar
added a commit
to ammaraskar/beef
that referenced
this issue
Nov 17, 2020
Currently it is possible to send across references to non-sync types across thread boundaries as long as they are wrapped in a Cow. This changes the trait bounds for `Send` to be the same as they are for the standard library's Cow https://doc.rust-lang.org/std/borrow/enum.Cow.html#impl-Send
You should probably consider yanking the versions with the incorrect bound. I'd also recommend submitting a RustSec advisory; it should be accepted, RUSTSEC-2021-0004 is a similar incorrect |
I'll handle reporting to RustSec :) |
This was referenced Jan 27, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the impl for
Send
onCow
should be bounded bySend + Sync
orSync
like it is for references and the std::Cow itself. (This issue was found by the rust group @sslab-gatech).beef/src/generic.rs
Line 531 in 0b46851
Without this it's possible to create references to a non-
Sync
object likeCell
through the use of a borrowed Cow. For example, consider the following program (usescrossbeam_utils
to make dealing with threads easier):This produces the output:
While this example is pretty benign, here's how it can lead to an arbitrary memory read from safe rust code:
Click to expand code snippet
This example produces:
The text was updated successfully, but these errors were encountered: