Skip to content

Commit d831831

Browse files
committed
lockedpool: When possible, use madvise to avoid including sensitive information in core dumps
1 parent 8a9ffec commit d831831

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/support/lockedpool.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
250250
addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
251251
if (addr) {
252252
*lockingSuccess = mlock(addr, len) == 0;
253+
#ifdef MADV_DONTDUMP
254+
madvise(addr, len, MADV_DONTDUMP);
255+
#endif
253256
}
254257
return addr;
255258
}

0 commit comments

Comments
 (0)