aboutsummaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2019-03-14 13:36:24 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-03-04 19:52:16 +0000
commitd831831822885717e9841f1ff67c19add566fa45 (patch)
tree644a0ec6acfe33d4b75daf4ec5acd67a66209f01 /src/support
parent8a9ffec0a257da659ba54c5073bfc820986ae9c1 (diff)
lockedpool: When possible, use madvise to avoid including sensitive information in core dumps
Diffstat (limited to 'src/support')
-rw-r--r--src/support/lockedpool.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp
index 070b3ed80e..fc1f660aec 100644
--- a/src/support/lockedpool.cpp
+++ b/src/support/lockedpool.cpp
@@ -250,6 +250,9 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (addr) {
*lockingSuccess = mlock(addr, len) == 0;
+#ifdef MADV_DONTDUMP
+ madvise(addr, len, MADV_DONTDUMP);
+#endif
}
return addr;
}