Skip to content

Commit ccdd384

Browse files
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``
2 parents 1324f97 + e90cb22 commit ccdd384

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

std/src/sys/sgx/abi/usercalls/alloc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ pub struct UserRef<T: ?Sized>(UnsafeCell<T>);
185185
#[unstable(feature = "sgx_platform", issue = "56975")]
186186
pub struct User<T: UserSafe + ?Sized>(NonNull<UserRef<T>>);
187187

188+
#[unstable(feature = "sgx_platform", issue = "56975")]
189+
unsafe impl<T: UserSafeSized> Send for User<T> {}
190+
191+
#[unstable(feature = "sgx_platform", issue = "56975")]
192+
unsafe impl<T: UserSafeSized> Send for User<[T]> {}
193+
188194
trait NewUserRef<T: ?Sized> {
189195
unsafe fn new_userref(v: T) -> Self;
190196
}

0 commit comments

Comments
 (0)