Skip to content

Conversation

@stouset
Copy link
Owner

@stouset stouset commented Aug 14, 2025

Closes #109.

Multiple Secret<T> instances could previously share the same memory page. This would cause funlock to unlock multiple secrets at a time. With secrets aligned to page boundaries, we ensure that no two secrets can share the same page.

Additionally we had detected the multiple-unlock case in Windows, which returns an error when funlock is called on an already-unlocked page. We swallowed errors in this case, but with this change we no longer need to do so.

@stouset
Copy link
Owner Author

stouset commented Aug 14, 2025

I hate this approach. I'm going to play around and see if I can get a #[repr(align(…))] one to work.

Closes #109.

Multiple `Secret<T>` instances could previously share the same memory
page. This would cause `munlock` to unlock multiple secrets at a time.
With secrets aligned to page boundaries, we ensure that no two secrets
can share the same page.

Additionally we had detected the multiple-unlock case in Windows, which
returns an error when `munlock` is called on an already-unlocked page.
We swallowed errors in this case, but with this change we no longer need
to do so.
@stouset stouset force-pushed the stephen/plwuourmyvlq branch from c7c8900 to ea99880 Compare August 14, 2025 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accidental unlocking of secrets

2 participants