Skip to content

Commit 0adb4b7

Browse files
authored
Merge pull request #1848 from codablock/pr_backport_bitcoin_0.14-3
Backport missing PRs from Bitcoin 0.14 - Part 3
2 parents 3aad9d9 + 9b1d1c6 commit 0adb4b7

File tree

123 files changed

+1074
-967
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1074
-967
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ linux-build
110110
win32-build
111111
qa/pull-tester/run-bitcoind-for-test.sh
112112
qa/pull-tester/tests_config.py
113-
qa/pull-tester/test.*/*
114-
qa/tmp
115113
qa/cache/*
116-
share/BitcoindComparisonTool.jar
117114

118115
!src/leveldb*/Makefile
119116

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ before it will be merged. The basic squashing workflow is shown below.
8787
# save and quit
8888
git push -f # (force push to GitHub)
8989

90+
If you have problems with squashing (or other workflows with `git`), you can
91+
alternatively enable "Allow edits from maintainers" in the right GitHub
92+
sidebar and ask for help in the pull request.
93+
94+
Please refrain from creating several pull requests for the same change.
95+
Use the pull request that is already open (or was created earlier) to amend
96+
changes. This preserves the discussion and review that happened earlier for
97+
the respective change set.
98+
9099
The length of time required for peer review is unpredictable and will vary from
91100
pull request to pull request.
92101

@@ -198,3 +207,11 @@ Release Policy
198207
--------------
199208

200209
The project leader is the release manager for each Dash Core release.
210+
211+
Copyright
212+
---------
213+
214+
By contributing to this repository, you agree to license your work under the
215+
MIT license unless specified otherwise in `contrib/debian/copyright` or at
216+
the top of the file itself. Any work contributed where you are not the original
217+
author must contain its license header with the original author(s) and source.

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ if test x$use_hardening != xno; then
491491

492492
AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"])
493493
AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"])
494+
AX_CHECK_LINK_FLAG([[-Wl,--high-entropy-va]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"])
494495
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"])
495496
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"])
496497

contrib/README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
Wallet Tools
2-
---------------------
3-
4-
### [SpendFrom](/contrib/spendfrom) ###
5-
6-
Use the raw transactions API to send coins received on a particular
7-
address (or addresses).
8-
91
Repository Tools
102
---------------------
113

contrib/devtools/git-subtree-check.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# Copyright (c) 2015 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
DIR="$1"
47
COMMIT="$2"

contrib/devtools/optimize-pngs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python
2+
# Copyright (c) 2014-2015 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25
'''
36
Run this script every time you change one of the png files. Using pngcrush, it will optimize the png files, remove various color profiles, remove ancillary chunks (alla) and text chunks (text).
47
#pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text

contrib/devtools/security-check.py

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python
2+
# Copyright (c) 2015-2016 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25
'''
36
Perform basic ELF security checks on a series of executables.
47
Exit status will be 0 if successful, and the program will be silent.
@@ -12,6 +15,7 @@
1215

1316
READELF_CMD = os.getenv('READELF', '/usr/bin/readelf')
1417
OBJDUMP_CMD = os.getenv('OBJDUMP', '/usr/bin/objdump')
18+
NONFATAL = {'HIGH_ENTROPY_VA'} # checks which are non-fatal for now but only generate a warning
1519

1620
def check_ELF_PIE(executable):
1721
'''
@@ -114,26 +118,50 @@ def check_ELF_Canary(executable):
114118

115119
def get_PE_dll_characteristics(executable):
116120
'''
117-
Get PE DllCharacteristics bits
121+
Get PE DllCharacteristics bits.
122+
Returns a tuple (arch,bits) where arch is 'i386:x86-64' or 'i386'
123+
and bits is the DllCharacteristics value.
118124
'''
119125
p = subprocess.Popen([OBJDUMP_CMD, '-x', executable], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
120126
(stdout, stderr) = p.communicate()
121127
if p.returncode:
122128
raise IOError('Error opening file')
129+
arch = ''
130+
bits = 0
123131
for line in stdout.split('\n'):
124132
tokens = line.split()
133+
if len(tokens)>=2 and tokens[0] == 'architecture:':
134+
arch = tokens[1].rstrip(',')
125135
if len(tokens)>=2 and tokens[0] == 'DllCharacteristics':
126-
return int(tokens[1],16)
127-
return 0
136+
bits = int(tokens[1],16)
137+
return (arch,bits)
128138

139+
IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020
140+
IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040
141+
IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100
129142

130-
def check_PE_PIE(executable):
143+
def check_PE_DYNAMIC_BASE(executable):
131144
'''PIE: DllCharacteristics bit 0x40 signifies dynamicbase (ASLR)'''
132-
return bool(get_PE_dll_characteristics(executable) & 0x40)
145+
(arch,bits) = get_PE_dll_characteristics(executable)
146+
reqbits = IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
147+
return (bits & reqbits) == reqbits
148+
149+
# On 64 bit, must support high-entropy 64-bit address space layout randomization in addition to DYNAMIC_BASE
150+
# to have secure ASLR.
151+
def check_PE_HIGH_ENTROPY_VA(executable):
152+
'''PIE: DllCharacteristics bit 0x20 signifies high-entropy ASLR'''
153+
(arch,bits) = get_PE_dll_characteristics(executable)
154+
if arch == 'i386:x86-64':
155+
reqbits = IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
156+
else: # Unnecessary on 32-bit
157+
assert(arch == 'i386')
158+
reqbits = 0
159+
return (bits & reqbits) == reqbits
133160

134161
def check_PE_NX(executable):
135162
'''NX: DllCharacteristics bit 0x100 signifies nxcompat (DEP)'''
136-
return bool(get_PE_dll_characteristics(executable) & 0x100)
163+
(arch,bits) = get_PE_dll_characteristics(executable)
164+
return (bits & IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) == IMAGE_DLL_CHARACTERISTICS_NX_COMPAT
137165

138166
CHECKS = {
139167
'ELF': [
@@ -143,7 +171,8 @@ def check_PE_NX(executable):
143171
('Canary', check_ELF_Canary)
144172
],
145173
'PE': [
146-
('PIE', check_PE_PIE),
174+
('DYNAMIC_BASE', check_PE_DYNAMIC_BASE),
175+
('HIGH_ENTROPY_VA', check_PE_HIGH_ENTROPY_VA),
147176
('NX', check_PE_NX)
148177
]
149178
}
@@ -168,12 +197,18 @@ def identify_executable(executable):
168197
continue
169198

170199
failed = []
200+
warning = []
171201
for (name, func) in CHECKS[etype]:
172202
if not func(filename):
173-
failed.append(name)
203+
if name in NONFATAL:
204+
warning.append(name)
205+
else:
206+
failed.append(name)
174207
if failed:
175208
print('%s: failed %s' % (filename, ' '.join(failed)))
176209
retval = 1
210+
if warning:
211+
print('%s: warning %s' % (filename, ' '.join(warning)))
177212
except IOError:
178213
print('%s: cannot open' % filename)
179214
retval = 1

contrib/devtools/test-security-check.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python2
2+
# Copyright (c) 2015-2016 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25
'''
36
Test script for security-check.py
47
'''

contrib/gitian-build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Copyright (c) 2016 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
15
# What to do
26
sign=false
37
verify=false

contrib/macdeploy/detached-sig-apply.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/sh
2+
# Copyright (c) 2014-2015 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
26
set -e
37

48
UNSIGNED="$1"

0 commit comments

Comments
 (0)