Skip to content

Commit

Permalink
Unrolled build for rust-lang#118241
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#118241 - fortanix:raoul/rust-langgh-530-make_userspace_types_send, r=Nilstrieb,dtolnay

Making `User<T>` and `User<[T]>` `Send`

All `User` types in SGX point to owned memory in userspace. Special care is always needed when accessing this memory as it must be assumed that an attacker is always able to change its content. Therefore, we can also easily transfer this memory between thread boundaries.

cc: ``@mzohreva`` ``@vn971`` ``@belalH`` ``@jethrogb``
  • Loading branch information
rust-timer committed Jan 9, 2024
2 parents 5876c8c + 4a8ba05 commit 8f7fff1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/std/src/sys/sgx/abi/usercalls/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ pub struct UserRef<T: ?Sized>(UnsafeCell<T>);
#[unstable(feature = "sgx_platform", issue = "56975")]
pub struct User<T: UserSafe + ?Sized>(NonNull<UserRef<T>>);

#[unstable(feature = "sgx_platform", issue = "56975")]
unsafe impl<T: UserSafeSized> Send for User<T> {}

#[unstable(feature = "sgx_platform", issue = "56975")]
unsafe impl<T: UserSafeSized> Send for User<[T]> {}

trait NewUserRef<T: ?Sized> {
unsafe fn new_userref(v: T) -> Self;
}
Expand Down

0 comments on commit 8f7fff1

Please sign in to comment.