Skip to content

Commit

Permalink
Merge pull request dogecoin#2673 from patricklodder/1.14.5-2019-15947
Browse files Browse the repository at this point in the history
security: Backport madvise() for lockedpool sensitive data from 1.21-dev
  • Loading branch information
Ross Nicoll authored Nov 6, 2021
2 parents df8adf0 + 09f86e7 commit 97c98cf
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 @@ -230,6 +230,11 @@ 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;
#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 97c98cf

Please sign in to comment.