Skip to content

Commit 9bd3f35

Browse files
committed
build: adds switch for disabling random base addresses in MSVC
1 parent 4c55f92 commit 9bd3f35

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

build_msvc/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,25 @@ For safety reasons the Bitcoin Core .appveyor.yml file has the artifact options
7777
#- 7z a bitcoin-%APPVEYOR_BUILD_VERSION%.zip %APPVEYOR_BUILD_FOLDER%\build_msvc\%platform%\%configuration%\*.exe
7878
#- path: bitcoin-%APPVEYOR_BUILD_VERSION%.zip
7979
```
80+
81+
Security
82+
---------------------
83+
[Base address randomization](https://docs.microsoft.com/en-us/cpp/build/reference/dynamicbase-use-address-space-layout-randomization?view=msvc-160) is used to make Bitcoin Core more secure. When building Bitcoin using the `build_msvc` process base address randomization can be disabled by editing `common.init.vcproj` to change `RandomizedBaseAddress` from `true` to `false` and then rebuilding the project.
84+
85+
To check if `bitcoind` has `RandomizedBaseAddress` enabled or disabled run
86+
87+
```
88+
.\dumpbin.exe /headers src/bitcoind.exe
89+
```
90+
91+
If is it enabled then in the output `Dynamic base` will be listed in the `DLL characteristics` under `OPTIONAL HEADER VALUES` as shown below
92+
93+
```
94+
8160 DLL characteristics
95+
High Entropy Virtual Addresses
96+
Dynamic base
97+
NX compatible
98+
Terminal Server Aware
99+
```
100+
101+
This may not disable all stack randomization as versions of windows employ additional stack randomization protections. These protections must be turned off in the OS configuration.

build_msvc/common.init.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
<Link>
106106
<SubSystem>Console</SubSystem>
107107
<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>
108+
<RandomizedBaseAddress>true</RandomizedBaseAddress>
108109
</Link>
109110
<Lib>
110111
<AdditionalOptions>/ignore:4221</AdditionalOptions>

0 commit comments

Comments
 (0)