aboutsummaryrefslogtreecommitdiff
path: root/build_msvc/common.init.vcxproj
diff options
context:
space:
mode:
authorW. J. van der Laan <laanwj@protonmail.com>2021-04-29 22:10:06 +0200
committerW. J. van der Laan <laanwj@protonmail.com>2021-04-29 22:14:34 +0200
commit298fd02e4a34666f049a02b63381692cde636658 (patch)
tree4254e72286bb7caa9344ee0d62aee47f365e2d8b /build_msvc/common.init.vcxproj
parent40310f5e8cd783a8114dc07224b435497bae6817 (diff)
parent9bd3f35003c2e9eff74766d57a71d6b391ab602a (diff)
Merge bitcoin/bitcoin#21045: build: adds switch to enable/disable randomized base address in MSVC builds
9bd3f35003c2e9eff74766d57a71d6b391ab602a build: adds switch for disabling random base addresses in MSVC (Ethan Heilman) Pull request description: In m4 builds we have the --disable-hardening switch that can be given in `./configure` to turn off randomized addresses. This PR provides a simple way of turning off randomized addresses in MSVC builds. This PR: * Adds this option the common-init project file so that it can be globally set across the project * Documents this switch in msvc build readme I have run the following test to verify this works I ran the msvc build with `<RandomizedBaseAddress>true</RandomizedBaseAddress>` then checked `bitcoind.exe` and `bitcoin-cli.exe` with `dumpbin.exe`: bitcoind ``` > .\dumpbin.exe /headers src/bitcoind.exe Microsoft (R) COFF/PE Dumper Version 14.16.27045.0 ... OPTIONAL HEADER VALUES 20B magic # (PE32+) 14.28 linker version AE4600 size of code 345C00 size of initialized data 0 size of uninitialized data 6BED74 entry point (00000001406BED74) mainCRTStartup 1000 base of code 140000000 image base (0000000140000000 to 0000000140E2DFFF) 1000 section alignment 200 file alignment 6.00 operating system version 0.00 image version 6.00 subsystem version 0 Win32 version E2E000 size of image 400 size of headers 0 checksum 3 subsystem (Windows CUI) 8160 DLL characteristics High Entropy Virtual Addresses Dynamic base NX compatible Terminal Server Aware ``` bitcoin-cli ``` > .\dumpbin.exe /headers src/bitcoin-cli.exe Microsoft (R) COFF/PE Dumper Version 14.16.27045.0 ... OPTIONAL HEADER VALUES 20B magic # (PE32+) 14.28 linker version 1E3E00 size of code 92C00 size of initialized data 0 size of uninitialized data 104384 entry point (0000000140104384) mainCRTStartup 1000 base of code 140000000 image base (0000000140000000 to 0000000140279FFF) 1000 section alignment 200 file alignment 6.00 operating system version 0.00 image version 6.00 subsystem version 0 Win32 version 27A000 size of image 400 size of headers 0 checksum 3 subsystem (Windows CUI) 8160 DLL characteristics High Entropy Virtual Addresses Dynamic base NX compatible Terminal Server Aware ``` Then I built with `<RandomizedBaseAddress>false</RandomizedBaseAddress>` then checked `bitcoind.exe` and `bitcoin-cli.exe` with `dumpbin.exe` and observed that `Dynamic base` was longer listed in `OPTIONAL HEADER VALUES` bitcoind ``` PS C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64> .\dumpbin.exe /headers C:\Users\e0\Documents\GitHub\bitcoin021noaslr/src/bitcoind.exe Microsoft (R) COFF/PE Dumper Version 14.16.27045.0 ... OPTIONAL HEADER VALUES 20B magic # (PE32+) 14.28 linker version AE4600 size of code 33FE00 size of initialized data 0 size of uninitialized data 6BED74 entry point (00000001406BED74) mainCRTStartup 1000 base of code 140000000 image base (0000000140000000 to 0000000140E27FFF) 1000 section alignment 200 file alignment 6.00 operating system version 0.00 image version 6.00 subsystem version 0 Win32 version E28000 size of image 400 size of headers 0 checksum 3 subsystem (Windows CUI) 8120 DLL characteristics High Entropy Virtual Addresses NX compatible Terminal Server Aware ``` bitcoin-cli ``` > .\dumpbin.exe /headers src/bitcoin-cli.exe Microsoft (R) COFF/PE Dumper Version 14.16.27045.0 ... OPTIONAL HEADER VALUES 20B magic # (PE32+) 14.28 linker version 1E3E00 size of code 90C00 size of initialized data 0 size of uninitialized data 104384 entry point (0000000140104384) mainCRTStartup 1000 base of code 140000000 image base (0000000140000000 to 0000000140277FFF) 1000 section alignment 200 file alignment 6.00 operating system version 0.00 image version 6.00 subsystem version 0 Win32 version 278000 size of image 400 size of headers 0 checksum 3 subsystem (Windows CUI) 8120 DLL characteristics High Entropy Virtual Addresses NX compatible Terminal Server Aware ``` ACKs for top commit: sipsorcery: ACK 9bd3f35003c2e9eff74766d57a71d6b391ab602a. practicalswift: cr ACK 9bd3f35003c2e9eff74766d57a71d6b391ab602a: patch looks correct Tree-SHA512: ddffdb4ff8a09c7cfef61c07a5db2a2828e9e3aa795ad8e5a1bf51ab489a68b40f87f6694518c5e0b8858c0fad4f93bb947b052e6b9d5e55eb38e764b746fc02
Diffstat (limited to 'build_msvc/common.init.vcxproj')
-rw-r--r--build_msvc/common.init.vcxproj1
1 files changed, 1 insertions, 0 deletions
diff --git a/build_msvc/common.init.vcxproj b/build_msvc/common.init.vcxproj
index f195d3d451..6ea018d846 100644
--- a/build_msvc/common.init.vcxproj
+++ b/build_msvc/common.init.vcxproj
@@ -105,6 +105,7 @@
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>Iphlpapi.lib;ws2_32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <RandomizedBaseAddress>true</RandomizedBaseAddress>
</Link>
<Lib>
<AdditionalOptions>/ignore:4221</AdditionalOptions>