From e95568b78ddead0173339ca98df6cd92131ceb62 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 22 Aug 2012 11:34:32 +0200 Subject: Handle locked pages more robustly (Fixes issue #1462) Memory locks do not stack, that is, pages which have been locked several times by calls to mlock() will be unlocked by a single call to munlock(). This can result in keying material ending up in swap when those functions are used naively. In this commit a class "LockedPageManager" is added that simulates stacking memory locks by keeping a counter per page. --- src/util.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index d6d9a368f0..461f42d177 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -86,6 +86,8 @@ void locking_callback(int mode, int i, const char* file, int line) } } +LockedPageManager LockedPageManager::instance; + // Init class CInit { -- cgit v1.2.3