Handle<T>unconditionally implements Send/Sync
kuzeyardabulut opened this issue · comments
kuzeyardabulut commented
Hi,
I found a memory-safety/soundness issue in this crate while scanning Rust code for potential vulnerabilities. This PR contains a fix for the issue.
Issue Description
Handle<T>
unconditionally implements Sync. This allows users to create data races on T: !Sync
. Such data races can lead to undefined behavior.
Lines 203 to 204 in 7f91449
This may not cause a direct data race. But making changes can be useful.
kuzeyardabulut commented
Dmitry Stepanov commented
It is impossible to get data races in Handle
struct, because its fields are just both u32
which both Send
+ Sync
. This unsafe impl is needed just to implement Send
+ Sync
for PhantomData<T>
. Any objections?