diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-13 11:13:22 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-11-13 11:13:22 -0500 |
commit | 15179a3e01eac0580703647ffcfe35cd2b9a5dce (patch) | |
tree | b040b74535b5d2609960ff3108822a8b21585fee | |
parent | c24b90e3ac011b6ca0a66d59cdbbde20135ec79c (diff) | |
parent | c928fb988a6679cc5aca380bcc568b165e5f7c4a (diff) | |
download | tor-15179a3e01eac0580703647ffcfe35cd2b9a5dce.tar.gz tor-15179a3e01eac0580703647ffcfe35cd2b9a5dce.zip |
Merge branch 'maint-0.2.9' into release-0.2.9
-rw-r--r-- | changes/ticket21953 | 6 | ||||
-rw-r--r-- | src/or/main.c | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/changes/ticket21953 b/changes/ticket21953 new file mode 100644 index 0000000000..7cc84f506d --- /dev/null +++ b/changes/ticket21953 @@ -0,0 +1,6 @@ + o Minor features: + - Enable a couple of pieces of Windows hardening: one + (HeapEnableTerminationOnCorruption) that has been on-by-default since + Windows 8, and unavailable before Windows 7, and one + (PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION) which we believe doesn't + affect us, but shouldn't do any harm. Closes ticket 21953. diff --git a/src/or/main.c b/src/or/main.c index 66a8571901..187b255bfb 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -3426,6 +3426,11 @@ tor_main(int argc, char *argv[]) int result = 0; #ifdef _WIN32 +#ifndef HeapEnableTerminationOnCorruption +#define HeapEnableTerminationOnCorruption 1 +#endif + /* On heap corruption, just give up; don't try to play along. */ + HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); /* Call SetProcessDEPPolicy to permanently enable DEP. The function will not resolve on earlier versions of Windows, and failure is not dangerous. */ @@ -3434,7 +3439,10 @@ tor_main(int argc, char *argv[]) typedef BOOL (WINAPI *PSETDEP)(DWORD); PSETDEP setdeppolicy = (PSETDEP)GetProcAddress(hMod, "SetProcessDEPPolicy"); - if (setdeppolicy) setdeppolicy(1); /* PROCESS_DEP_ENABLE */ + if (setdeppolicy) { + /* PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION */ + setdeppolicy(3); + } } #endif |