File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ impl<T: Transmittable> Fifo<T> {
9494 "Fifo len should be a power of two"
9595 ) ;
9696 #[ cfg( target_env = "sgx" ) ] {
97- use std:: os:: fortanix_sgx:: usercalls:: alloc:: User ;
97+ use std:: os:: fortanix_sgx:: usercalls:: alloc:: { User , UserRef } ;
9898
9999 // `fortanix_sgx_abi::WithId` is not `Copy` because it contains an `AtomicU64`.
100100 // This type has the same memory layout but is `Copy` and can be marked as
@@ -112,9 +112,15 @@ impl<T: Transmittable> Fifo<T> {
112112 let _: [ u8 ; size_of :: < fortanix_sgx_abi:: WithId < ( ) > > ( ) ] = [ 0u8 ; size_of :: < WithId < ( ) > > ( ) ] ;
113113 }
114114
115+ #[ repr( transparent) ]
116+ #[ derive( Copy , Clone ) ]
117+ struct WrapUsize ( usize ) ;
118+ unsafe impl UserSafeSized for WrapUsize { }
119+
115120 // check pointers are outside enclave range, etc.
116121 let data = User :: < [ WithId < T > ] > :: from_raw_parts ( descriptor. data as _ , descriptor. len ) ;
117122 mem:: forget ( data) ;
123+ UserRef :: from_ptr ( descriptor. offsets as * const WrapUsize ) ;
118124 }
119125 let data_slice = std:: slice:: from_raw_parts ( descriptor. data , descriptor. len ) ;
120126 Self {
You can’t perform that action at this time.
0 commit comments