Skip to content

Commit f8685f4

Browse files
committed
Merge bitcoin#13764: contrib: Fix test-security-check fail in Ubuntu 18.04
1e60713 contrib: Fix test-security-check fail in Ubuntu 18.04 (Chun Kuan Lee) Pull request description: - Fix test-security-check fail in Ubuntu 18.04. Those flags are enabled by default, so we must specify `-no` to make the executable does 'not' have those attributes. - Drop HIGH_ENTROPY_VA. After update our gitian system to Bionic, the compiler should support HIGH_ENTROPY_VA Tree-SHA512: 78c1f2aae1253ddd52faa1af569b7151a503a217c7ccbe21b8004d8910c45d8a27ff04695eacbdadd7192d2c91c0d59941ca20c651dd2d5052b9999163a11ae4
2 parents 222e627 + 1e60713 commit f8685f4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

contrib/devtools/security-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

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

1919
def check_ELF_PIE(executable):
2020
'''

contrib/devtools/test-security-check.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def test_ELF(self):
3232
cc = 'gcc'
3333
write_testcode(source)
3434

35-
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-fno-stack-protector','-Wl,-znorelro']),
35+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE']),
3636
(1, executable+': failed PIE NX RELRO Canary'))
37-
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fno-stack-protector','-Wl,-znorelro']),
37+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE']),
3838
(1, executable+': failed PIE RELRO Canary'))
39-
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro']),
39+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-no-pie','-fno-PIE']),
4040
(1, executable+': failed PIE RELRO'))
4141
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-pie','-fPIE']),
4242
(1, executable+': failed RELRO'))
@@ -49,9 +49,9 @@ def test_32bit_PE(self):
4949
cc = 'i686-w64-mingw32-gcc'
5050
write_testcode(source)
5151

52-
self.assertEqual(call_security_check(cc, source, executable, []),
52+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--no-nxcompat','-Wl,--no-dynamicbase']),
5353
(1, executable+': failed DYNAMIC_BASE NX'))
54-
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat']),
54+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--no-dynamicbase']),
5555
(1, executable+': failed DYNAMIC_BASE'))
5656
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase']),
5757
(0, ''))
@@ -61,9 +61,9 @@ def test_64bit_PE(self):
6161
cc = 'x86_64-w64-mingw32-gcc'
6262
write_testcode(source)
6363

64-
self.assertEqual(call_security_check(cc, source, executable, []), (1, executable+': failed DYNAMIC_BASE NX\n'+executable+': warning HIGH_ENTROPY_VA'))
65-
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat']), (1, executable+': failed DYNAMIC_BASE\n'+executable+': warning HIGH_ENTROPY_VA'))
66-
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase']), (0, executable+': warning HIGH_ENTROPY_VA'))
64+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--no-nxcompat','-Wl,--no-dynamicbase','-Wl,--no-high-entropy-va']), (1, executable+': failed DYNAMIC_BASE HIGH_ENTROPY_VA NX'))
65+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--no-dynamicbase','-Wl,--no-high-entropy-va']), (1, executable+': failed DYNAMIC_BASE HIGH_ENTROPY_VA'))
66+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--no-high-entropy-va']), (1, executable+': failed HIGH_ENTROPY_VA'))
6767
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--high-entropy-va']), (0, ''))
6868

6969
if __name__ == '__main__':

0 commit comments

Comments
 (0)