Skip to content

Commit b549cb1

Browse files
committed
Merge #18443: lockedpool: avoid sensitive data in core files (FreeBSD)
f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov) Pull request description: This is a followup to 23991ee / bitcoin/bitcoin#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. ACKs for top commit: sipa: ACK f852030 if someone verifies this works as intended on *BSD. laanwj: ACK f852030 practicalswift: Code-review ACK f852030 assuming a reviewer with FreeBSD access verifies that the PR goal is achieved :) Tree-SHA512: 2e6d4ab6a9fbe18732c8ba530eacc17f58128c97140758b80c905b5b838922a2bcaa5f9abc45ab69d5a1a2baa0cba322f006048b60a877228e089c7e64dadd2a
2 parents 23c926d + f852030 commit b549cb1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/support/lockedpool.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
253253
}
254254
if (addr) {
255255
*lockingSuccess = mlock(addr, len) == 0;
256-
#ifdef MADV_DONTDUMP
256+
#if defined(MADV_DONTDUMP) // Linux
257257
madvise(addr, len, MADV_DONTDUMP);
258+
#elif defined(MADV_NOCORE) // FreeBSD
259+
madvise(addr, len, MADV_NOCORE);
258260
#endif
259261
}
260262
return addr;

0 commit comments

Comments
 (0)