lockedpool: When possible, use madvise to avoid including sensitive information in core dumps

This commit is contained in:
Luke Dashjr 2019-03-14 13:36:24 +00:00 committed by Jack Grigg
parent 4277ef2063
commit 6b278b20cb
1 changed files with 3 additions and 0 deletions

View File

@ -257,6 +257,9 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
}
if (addr) {
*lockingSuccess = mlock(addr, len) == 0;
#ifdef MADV_DONTDUMP
madvise(addr, len, MADV_DONTDUMP);
#endif
}
return addr;
}