mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
lockedpool: When possible, use madvise to avoid including sensitive information in core dumps
This commit is contained in:
parent
8a9ffec0a2
commit
d831831822
1 changed files with 3 additions and 0 deletions
|
@ -250,6 +250,9 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
|
||||||
addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||||
if (addr) {
|
if (addr) {
|
||||||
*lockingSuccess = mlock(addr, len) == 0;
|
*lockingSuccess = mlock(addr, len) == 0;
|
||||||
|
#ifdef MADV_DONTDUMP
|
||||||
|
madvise(addr, len, MADV_DONTDUMP);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue