Skip to content

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Mar 14, 2019

If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, and unmap it from forked processes.

The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

@luke-jr
Copy link
Member Author

luke-jr commented May 5, 2019

No apparent reviewer interest, and it seems to break -daemon with no obvious solution.

@luke-jr luke-jr reopened this Mar 4, 2020
@luke-jr luke-jr force-pushed the lockedpool_dontdump branch from 23d5d9a to d831831 Compare March 4, 2020 20:16
@luke-jr
Copy link
Member Author

luke-jr commented Mar 4, 2020

Reopened due to renewed interest, and removed the DONTFORK part that was broken

@luke-jr luke-jr changed the title lockedpool: When possible, use madvise to avoid including sensitive information in core dumps or forked process memory spaces lockedpool: When possible, use madvise to avoid including sensitive information in core dumps Mar 4, 2020
@practicalswift
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 5, 2020

Gitian builds

File commit a71c347
(master)
commit 2d32037
(master and this pull)
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz 263dd4df65588db4... 87a836ebe2640c24...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 3f779204013ffde0... b25121535f4b3e4e...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz f6cc7d17fdf2b4f0... 9bf22b2ea053fe9f...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz b08643b04f8d69c0... 0811dc229d30b135...
bitcoin-0.19.99-osx-unsigned.dmg 82112ea8d8b8dfb7... 3f15eeb9c8995188...
bitcoin-0.19.99-osx64.tar.gz e7408d167771af4e... 452145dfff313f76...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz af924ded182d7648... 98cdc0cf6d4dcb61...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz d6a4f981ad9fa31f... f71881fa68838b30...
bitcoin-0.19.99-win64-debug.zip b0796bf49b421fa0... 8b6b299372408b9b...
bitcoin-0.19.99-win64-setup-unsigned.exe 3a473d863012b1fe... 340157f6bb540f2b...
bitcoin-0.19.99-win64.zip f658d68b14d640c3... 5a0e6165b71cc67f...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz dbab3fa3cc95a255... 554ef07154623a5d...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz fa419172b1f67f66... de1b54355262591a...
bitcoin-0.19.99.tar.gz 38d9e79747ecfb3b... 558c333681cb5459...
bitcoin-core-linux-0.20-res.yml 0bb8e45015337601... 4e8a46fb1c0d3f43...
bitcoin-core-osx-0.20-res.yml 587b85f6de99b01c... 14718c9a1dc15f0c...
bitcoin-core-win-0.20-res.yml 4cb36ab35ba216ed... 903f3ad4472eea5e...
linux-build.log 17b4963debeaff4c... cb1bc7e73f69d362...
osx-build.log de1d4010171bee32... 30eed6610c634837...
win-build.log a7428da768940c64... 6a23faa140bab3c4...
bitcoin-core-linux-0.20-res.yml.diff 88743d508c492414...
bitcoin-core-osx-0.20-res.yml.diff a6e23042337e3f57...
bitcoin-core-win-0.20-res.yml.diff c308f24f99ffc760...
linux-build.log.diff 50481d877cfcb295...
osx-build.log.diff 1125ea1d898b8949...
win-build.log.diff 7e982717b61ae018...

@laanwj laanwj added this to the 0.20.0 milestone Mar 5, 2020
@laanwj
Copy link
Member

laanwj commented Mar 5, 2020

Concept ACK

@practicalswift
Copy link
Contributor

Code review ACK d831831 -- patch looks correct

Please note that I have not verified that the desired end result is achieved.

That should be done before merge :)

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d831831

Code review and rebased on master/built/tests/ran bitcoind. The concept appears correct according to man core

  There are various circumstances in which a core dump file is not produced:

  ... / ...

  In addition, a core dump may exclude part of the address space of the
  process if the madvise(2) MADV_DONTDUMP flag was employed.

and implementation correct as per man madvise

  MADV_DONTDUMP (since Linux 3.4)
    Exclude from a core dump those pages in the range specified by
    addr and length.  This is useful in applications that have
    large areas of memory that are known not to be useful in a
    core dump.  The effect of MADV_DONTDUMP takes precedence over
    the bit mask that is set via the /proc/[pid]/coredump_filter
    file (see core(5)).

  ... / ...

  RETURN VALUE
    On success, madvise() returns zero. 
    On error, it returns -1 and errno is set appropriately.

EDIT: tested as described in #15600 (comment) below

@@ -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);
if (addr) {
*lockingSuccess = mlock(addr, len) == 0;
#ifdef MADV_DONTDUMP
madvise(addr, len, MADV_DONTDUMP);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the return value be used to signal success/failure to the user?

@laanwj
Copy link
Member

laanwj commented Mar 25, 2020

I checked the manual page for madvise and I think the usage is correct.

Not checking the return value is okay in this case because if it fails, there's no problem. The function is not marked as "warn_unused_result" so this won't result in compiler warnings either.

/usr/include/x86_64-linux-gnu/sys/mman.h:

extern int madvise (void *__addr, size_t __len, int __advice) __THROW;

ACK d831831

@jonatack
Copy link
Member

Agree.

/usr/include/x86_64-linux-gnu/sys/mman.h:

#ifdef __USE_MISC
/* Advise the system about particular usage patterns the program follows
   for the region starting at ADDR and extending LEN bytes.  */
extern int madvise (void *__addr, size_t __len, int __advice) __THROW;
#endif

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d831831

But notice support for FreeBSD is easy to hook, so I would suggest to add it.

I tested this on FreeBSD by writing some specific string to the allocated memory and calling abort();. Then ./src/bitcoind crashes immediately. It works as expected: without madvise() the string is present in the core file. With madvise() the string is absent.

I also verified that the effects of the new call need not be explicitly undone when freeing up the memory. For example we undo the mlock() call in FreeLocked() by doing munlock(). I was worried that if we don't do madvise(MADV_DODUMP) when we free the page to the OS, then maybe later, if we allocate it again then MADV_DONTDUMP would be in effect without us asking for it. But this is not the case.

For reference here are the changes I did to test it:

basic test
--- i/src/support/lockedpool.cpp
+++ w/src/support/lockedpool.cpp
@@ -250,15 +250,23 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
     addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
     if (addr == MAP_FAILED) {
         return nullptr;
     }
     if (addr) {
         *lockingSuccess = mlock(addr, len) == 0;
-#ifdef MADV_DONTDUMP
+#if 1
+#if defined(MADV_DONTDUMP) // Linux
         madvise(addr, len, MADV_DONTDUMP);
+#elif defined(MADV_NOCORE) // FreeBSD
+        madvise(addr, len, MADV_NOCORE);
 #endif
+#endif
+        memset(addr, 'A', 16);
+        memset((char*)addr + 16, 'B', 16);
+        memset((char*)addr + 32, 'C', 16);
+        abort();
     }
     return addr;
 }
 void PosixLockedPageAllocator::FreeLocked(void* addr, size_t len)
 {
     len = align_up(len, page_size);
test that undo is not necessary
--- i/src/support/lockedpool.cpp
+++ w/src/support/lockedpool.cpp
@@ -250,15 +250,36 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
     addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
     if (addr == MAP_FAILED) {
         return nullptr;
     }
     if (addr) {
         *lockingSuccess = mlock(addr, len) == 0;
-#ifdef MADV_DONTDUMP
+#if 1
+#if defined(MADV_DONTDUMP) // Linux
         madvise(addr, len, MADV_DONTDUMP);
+#elif defined(MADV_NOCORE) // FreeBSD
+        madvise(addr, len, MADV_NOCORE);
 #endif
+#endif
+        FreeLocked(addr, len);
+
+        // Allocate again to confirm that the effect of MADV_DONTDUMP/MADV_NOCORE
+        // has vanished. The string must be in the core file.
+        void* new_addr = mmap(addr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+
+        if (new_addr == MAP_FAILED) {
+            perror("mmap");
+            exit(1);
+        }
+
+        assert(new_addr == addr);
+
+        memset(addr, 'A', 16);
+        memset((char*)addr + 16, 'B', 16);
+        memset((char*)addr + 32, 'C', 16);
+        abort();
     }
     return addr;
 }
 void PosixLockedPageAllocator::FreeLocked(void* addr, size_t len)
 {
     len = align_up(len, page_size);

Comment on lines +253 to +255
#ifdef MADV_DONTDUMP
madvise(addr, len, MADV_DONTDUMP);
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeBSD has the same functionality under a different name MADV_NOCORE:

Suggested change
#ifdef MADV_DONTDUMP
madvise(addr, len, MADV_DONTDUMP);
#endif
#if defined(MADV_DONTDUMP) // Linux
madvise(addr, len, MADV_DONTDUMP);
#elif defined(MADV_NOCORE) // FreeBSD
madvise(addr, len, MADV_NOCORE);
#endif

@jonatack
Copy link
Member

@vasild thanks for the interesting tests! Good idea. Here are similar steps I took to reproduce them:

test that without madvise string is present in core dump

(pr/15600)$ uname -a
Linux 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux
(pr/15600)$ ulimit -c unlimited && git diff && make
--- a/src/support/lockedpool.cpp
+++ b/src/support/lockedpool.cpp
@@ -23,6 +23,7 @@
 #include <algorithm>
+#include <cstring>
 #ifdef ARENA_DEBUG
@@ -253,9 +254,14 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
     if (addr) {
         *lockingSuccess = mlock(addr, len) == 0;
-#ifdef MADV_DONTDUMP
-        madvise(addr, len, MADV_DONTDUMP);
-#endif
+        memset(addr, 'A', 16);
+        memset((char*)addr + 16, 'B', 16);
+        memset((char*)addr + 32, 'C', 16);
+        printf("\n");
+        printf("Process is aborting\n");
+        abort();
+        printf("Control not reaching here\n");
+        return 0;
     }
     return addr;
 }
(pr/15600)$ bitcoind

Process is aborting
Aborted (core dumped)
(pr/15600)$ grep AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCC core
Binary file core matches
(pr/15600)$

test that with madvise string is absent from core dump

(pr/15600)$ uname -a
Linux 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux
(pr/15600)$ ulimit -c unlimited && git diff && make
--- a/src/support/lockedpool.cpp
+++ b/src/support/lockedpool.cpp
@@ -23,6 +23,7 @@
 #include <algorithm>
+#include <cstring>
 #ifdef ARENA_DEBUG
 #include <iomanip>
 #include <iostream>
@@ -253,9 +254,21 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
     if (addr) {
         *lockingSuccess = mlock(addr, len) == 0;
-#ifdef MADV_DONTDUMP
+#if defined(MADV_DONTDUMP) // Linux
         madvise(addr, len, MADV_DONTDUMP);
+#elif defined(MADV_NOCORE) // FreeBSD
+        madvise(addr, len, MADV_NOCORE);
 #endif
+        memset(addr, 'A', 16);
+        memset((char*)addr + 16, 'B', 16);
+        memset((char*)addr + 32, 'C', 16);
+        printf("\n");
+        printf("Process is aborting\n");
+        abort();
+        printf("Control not reaching here\n");
+        return 0;
     }
     return addr;
 }
(pr/15600)$ bitcoind

Process is aborting
Aborted (core dumped)
(pr/15600)$ grep AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCC core
(pr/15600)$

@laanwj
Copy link
Member

laanwj commented Mar 26, 2020

I'm going ahead to merge this. Let's add FreeBSD support in a new PR.

@laanwj laanwj merged commit 23991ee into bitcoin:master Mar 26, 2020
vasild added a commit to vasild/bitcoin that referenced this pull request Mar 26, 2020
This is a followup to
23991ee / 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.
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 28, 2020
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
laanwj added a commit that referenced this pull request May 4, 2020
f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / #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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 4, 2020
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
zkbot added a commit to zcash/zcash that referenced this pull request Sep 29, 2020
Locked memory manager

Add a pool for locked memory chunks, replacing `LockedPageManager`.

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#8321
- bitcoin/bitcoin#8753
- bitcoin/bitcoin#9063
- bitcoin/bitcoin#9070
- bitcoin/bitcoin#11385
- bitcoin/bitcoin#12048
  - Excludes change to benchmark.
- bitcoin/bitcoin#15117
- bitcoin/bitcoin#16161
  - Excludes Travis CI changes.
  - Includes change from bitcoin/bitcoin#13163
- bitcoin/bitcoin#15600
- bitcoin/bitcoin#18443
- Assorted small changes from:
  - bitcoin/bitcoin#9233
  - bitcoin/bitcoin#10483
  - bitcoin/bitcoin#10645
  - bitcoin/bitcoin#10969
  - bitcoin/bitcoin#11351
- bitcoin/bitcoin#19111
  - Excludes change to `src/rpc/server.cpp`
- bitcoin/bitcoin#9804
  - Only the commit for `src/key.cpp`
- bitcoin/bitcoin#9598
van-orton pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Oct 30, 2020
This is a followup to
23991ee53 / 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.
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 12, 2021
…nformation in core dumps

Summary:
Issue bitcoin#16824
> On a crash, bitcoin-qt may dump a core file that contains what was in memory at the time of the crash, for debugging purposes. The problem here is that bitcoin-qt stores the user's wallet.dat unencrypted in memory. With this information it becomes rather trivial to reconstruct parts of a user's wallet.dat from a .core dump alone.
> You can find the wallets within the core file simply by grepping for known parts of a wallet.dat ex: xxd bitcoin-qt.core | grep "6231 0500" With this information you can find the offset of the wallet within the core file, and reconstruct it per a known wallet.dat's length. Upon reloading the extracted wallet into bitcoin-qt, you'll lose address book information - but balance is retained. This has been assigned CVE-2019-15947.

This is a backport of Core [[bitcoin/bitcoin#15600 | PR15600]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, deadalnix, Fabien

Reviewed By: #bitcoin_abc, deadalnix, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8879
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 12, 2021
Summary:
> This is a followup to [[bitcoin/bitcoin#15600 | PR15600]] 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 is a backport of Core [[bitcoin/bitcoin#18443 | PR18443]]

Depends on D8879

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, deadalnix, Fabien

Reviewed By: #bitcoin_abc, deadalnix, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8880
lordmahan added a commit to browncoin-project/Browncoin that referenced this pull request Apr 27, 2021
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 14, 2021
…including sensitive information in core dumps

d831831 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831 -- patch looks correct
  laanwj:
    ACK d831831
  jonatack:
    ACK d831831
  vasild:
    ACK d831831

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 14, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 15, 2021
…FreeBSD)

f852030 lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)

Pull request description:

  This is a followup to
  23991ee / 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
patricklodder pushed a commit to patricklodder/dogecoin that referenced this pull request Nov 5, 2021
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.
random-zebra pushed a commit to random-zebra/PIVX that referenced this pull request Dec 27, 2021
This is a followup to
23991ee / 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.
furszy added a commit to PIVX-Project/PIVX that referenced this pull request Jan 3, 2022
353346c lockedpool: avoid sensitive data in core files (FreeBSD) (Vasil Dimov)
18ca764 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  Backports of bitcoin#15600 and bitcoin#18443 patching [CVE-2019-15947](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-15947).

ACKs for top commit:
  Fuzzbawls:
    utACK 353346c
  furszy:
    utACK 353346c and merging..

Tree-SHA512: 4e5108803be2881b2b25ed135ce498c04d0ee9b5444d506790f323a32d556497539e6bb139840eea101e33013475e0d2002d5fc4a0bbf03e3e5e388eeb7564c3
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants