You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put together a quick example where two Secret instances may end up on the same page, such that dropping the second one will munlock the first one prior to it being dropped (make sure to test debug and release mode):
I've found that in this case, increasing the size of the Secret instance such that it always takes up a page on the stack can help to prevent this issue. For example, updating it to:
pubstructSecret<T:Bytes>{spacer:[u8;4096],/// The internal protected memory for the [`Secret`].data:T,}
The spacer size could potentially be larger, notably the page size is 16384 bytes on recent Macs. Alternatively, it appears that the alignment on Secret can be set to a larger value which would also have a similar effect:
#[repr(align(4096))]pubstructSecret<T:Bytes>{/// The internal protected memory for the [`Secret`].data:T,}
The text was updated successfully, but these errors were encountered:
I put together a quick example where two
Secret
instances may end up on the same page, such that dropping the second one willmunlock
the first one prior to it being dropped (make sure to test debug and release mode):I've found that in this case, increasing the size of the
Secret
instance such that it always takes up a page on the stack can help to prevent this issue. For example, updating it to:The spacer size could potentially be larger, notably the page size is 16384 bytes on recent Macs. Alternatively, it appears that the alignment on
Secret
can be set to a larger value which would also have a similar effect:The text was updated successfully, but these errors were encountered: