I understand that the operating system generates a core dump sometimes when a signal is sent (usually upon a crash). Is there a way to tell the operating system from inside C/C++ via a #define or compiler flag that no, or a somehow specifically limited core dump can be generated via that executable? The only way I know of to control it is via ulimit -c. My test system is Linux. The no core dump does not need to be implemented system wide, only for a specific program.
For the interested, this has to do with CVE-2019-15947 in Bitcoin Core's bitcoin-qt which still has no solution.
Some of this discussion is at the Bitcoin GitHub bug tracking page.
The other option would be to obfunscate and or encrypt the wallet.dat in memory so it's not easily retrievable via core dumps. Please note the second option can already be accomplished, though is not enabled by default.
SIGSEGV
yourself, but if your code is running on my system, using my libraries, running under my kernel, and I want your code to dump core when it gets aSIGSEGV
, it's going to dump core when it gets aSIGSEGV
. – Downtimememset()
calls that only effect memory that gets freed, for example, can be elided by optimizing compilers. – Downtimesetrlimit
wouldn't work. Can you post your complete test case and explain what happened when you ran it? – NegroSegmentation fault (core dumped)
but no core file is actually produced. – Negrocore
file in the current working directory, and with setrlimit it did not. – Negro