poanetwork / threshold_crypto

A pairing-based threshold cryptosystem for collaborative decryption and signatures used in HoneybadgerBFT implementation
Other
189 stars 72 forks source link

Dont unlock more than one secret at a time #31

Closed DrPeterVanNostrand closed 5 years ago

DrPeterVanNostrand commented 6 years ago

munlock() will unlock full pages of memory. Right now, we call munlock() upon every secret deallocation. This means that we may be preemptively unlocking secrets from RAM, if two secrets occupy the same page of memory, and one is dropped before the other.

Implement a counter that keeps track of the number of secrets allocated in each page of memory. Wait until a page's count is zero before calling munlock() on the page.

The counter should be incremented via ContainsSecret::mlock_secret(&self) and ContainsSecret::munlock_secret(&self). The counter must be thread safe.

afck commented 6 years ago

If we do #42, this issue is probably obsolete.

afck commented 5 years ago

Closing in favor of #42.