mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-17 21:50:43 +02:00
lockedpool: avoid sensitive data in core files (FreeBSD)
This is a followup to
23991ee53
/ https://github.com/bitcoin/bitcoin/pull/15600
to also use madvise(2) on FreeBSD to avoid sensitive data allocated
with secure_allocator ending up in core files in addition to preventing
it from going to the swap.
This commit is contained in:
parent
7f9dedb22d
commit
f85203097f
@ -253,8 +253,10 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
|
|||||||
}
|
}
|
||||||
if (addr) {
|
if (addr) {
|
||||||
*lockingSuccess = mlock(addr, len) == 0;
|
*lockingSuccess = mlock(addr, len) == 0;
|
||||||
#ifdef MADV_DONTDUMP
|
#if defined(MADV_DONTDUMP) // Linux
|
||||||
madvise(addr, len, MADV_DONTDUMP);
|
madvise(addr, len, MADV_DONTDUMP);
|
||||||
|
#elif defined(MADV_NOCORE) // FreeBSD
|
||||||
|
madvise(addr, len, MADV_NOCORE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return addr;
|
return addr;
|
||||||
|
Loading…
Reference in New Issue
Block a user