Skip to content

Commit

Permalink
lockedpool: When possible, use madvise to avoid including sensitive i…
Browse files Browse the repository at this point in the history
…nformation in core dumps or forked process memory spaces
  • Loading branch information
luke-jr committed Mar 14, 2019
1 parent 9828f9a commit b021868
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/support/lockedpool.cpp
Expand Up @@ -230,6 +230,12 @@ 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_DONTFORK
madvise(addr, len, MADV_DONTFORK);
#endif
#ifdef MADV_DONTDUMP
madvise(addr, len, MADV_DONTDUMP);
#endif
}
return addr;
}
Expand Down

0 comments on commit b021868

Please sign in to comment.