Skip to content

Commit

Permalink
Merge pull request #2509 from barton2526/lockedpool_dontdump
Browse files Browse the repository at this point in the history
lockedpool: When possible, use madvise to avoid including sensitive information in core dumps
  • Loading branch information
jamescowens committed May 20, 2022
2 parents 0e91de6 + 401b71f commit c3122d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/support/lockedpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
}
if (addr) {
*lockingSuccess = mlock(addr, len) == 0;
#if defined(MADV_DONTDUMP) // Linux
madvise(addr, len, MADV_DONTDUMP);
#elif defined(MADV_NOCORE) // FreeBSD
madvise(addr, len, MADV_NOCORE);
#endif
}
return addr;
}
Expand Down

0 comments on commit c3122d6

Please sign in to comment.