Skip to content

Current use of pin is unsound #286

Closed
@nbdd0121

Description

@nbdd0121

In rust_miscdev, this would compile:

let mut state = SharedState::try_new()?;
let mut state2 = SharedState::try_new()?;
core::mem::swap(Arc::get_mut(&mut state).unwrap(), Arc::get_mut(&mut state2).unwrap()); 

but this swaps two pinned CondVar, which is unsound. After pinning the CondVar, we shouldn't be able to obtain any Arc<SharedState>, but rather only Pin<Arc<SharedState>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersunsoundThe possibility of UB in safe code.• driversRelated to the example drivers in `drivers/`.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions