Description
When a long-running gocryptfs process is paged out of memory the plain decrypted key stored to disk. With modern SSD drives and wear levelling the key could remain forensically recoverable for months or years.
This can be mitigated using an mlock facility like memguard (the go equivalent of libsodium), which manages memory slices that are guaranteed not to page out.
it looks like memguard could be dropped into the bPool
interface without much work. You'd just need to make sure that the user password and decrypted key are only ever stored in memguard-managed memory.
(For bonus points it might be interesting to use the facility for cleartext content buffers too, ensuring that the gocryptfs process doesn't compromise confidential user data either.)