aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-01-20 20:54:23 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-01-20 20:55:13 +0100
commit631df3ee87ec93e1fc748715671cdb5cff7308e6 (patch)
treee738ad1dc062c7313ec8c5b3f88af9f7ebb71a2e /src/init.cpp
parentdaae6403d8bd1d03b108d0517bd74e3197e315a8 (diff)
parent3d5d7aad269c7afe7e36677d3e76c6579e1b8aba (diff)
Merge #17916: windows: Enable heap terminate-on-corruption
3d5d7aad269c7afe7e36677d3e76c6579e1b8aba windows: remove call to SetProcessDEPPolicy (fanquake) f2645c26017591f819344d24dc0a88dc32dde6fd windows: Enable heap terminate-on-corruption (fanquake) Pull request description: This PR is currently two separate changes: #### Enable heap terminate-on-corruption This is default behavior from Windows 8 onwards, however we still support Windows 7, so it should make sense to explicitly enable this. This is also done by projects like tor, chromium etc. > Enables the terminate-on-corruption feature. If the heap manager detects an error in any heap used by the process, it calls the Windows Error Reporting service and terminates the process. After a process enables this feature, it cannot be disabled. More info [here](https://docs.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heapsetinformation). #### Remove call to SetProcessDEPPolicy() DEP is always enabled on 64-bit Windows processes, and `SetProcessDEPPolicy()` only works when called from a 32-bit process. I've tested that our current usage always fails ([as expected](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setprocessdeppolicy#remarks)) with [ERROR_NOT_SUPPORTED](https://github.com/mirror/mingw-w64/blob/16151c441e89081fd398270bb888511ebef6fb35/mingw-w64-headers/include/error.h#L42). Please don't add a "Needs gitian build" tag here yet. ACKs for top commit: sipsorcery: ACK 3d5d7aad269c7afe7e36677d3e76c6579e1b8aba. laanwj: ACK 3d5d7aad269c7afe7e36677d3e76c6579e1b8aba Tree-SHA512: 0948bcf165685b6b573f2cd950680c34356b856690de655ced2b93d497e02e7b22aa195c99f6ce33202f182622c67302ff31c98ab51b7d050574af3debdee5ce
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 92481c4a7e..21b7a26cb9 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -877,8 +877,8 @@ bool AppInitBasicSetup()
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
#ifdef WIN32
- // Enable Data Execution Prevention (DEP)
- SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
+ // Enable heap terminate-on-corruption
+ HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0);
#endif
if (!SetupNetworking())