Skip to content
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

SGX mutex is *not* moveable #87507

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion library/std/src/sys/sgx/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ pub struct Mutex {
inner: SpinMutex<WaitVariable<bool>>,
}

pub type MovableMutex = Mutex;
// not movable: see UnsafeList implementation
pub type MovableMutex = Box<Mutex>;

// Implementation according to “Operating Systems: Three Easy Pieces”, chapter 28
impl Mutex {
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/sgx/waitqueue/unsafe_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl<T> UnsafeListEntry<T> {
}
}

// WARNING: self-referential struct!
pub struct UnsafeList<T> {
head_tail: NonNull<UnsafeListEntry<T>>,
head_tail_entry: Option<UnsafeListEntry<T>>,
Expand Down