|
|
|
@ -43,16 +43,20 @@ class TestSecurityChecks(unittest.TestCase):
|
|
|
|
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE']),
|
|
|
|
|
(0, ''))
|
|
|
|
|
|
|
|
|
|
def test_64bit_PE(self):
|
|
|
|
|
def test_PE(self):
|
|
|
|
|
source = 'test1.c'
|
|
|
|
|
executable = 'test1.exe'
|
|
|
|
|
cc = 'x86_64-w64-mingw32-gcc'
|
|
|
|
|
write_testcode(source)
|
|
|
|
|
|
|
|
|
|
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'))
|
|
|
|
|
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'))
|
|
|
|
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--no-high-entropy-va']), (1, executable+': failed HIGH_ENTROPY_VA'))
|
|
|
|
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--high-entropy-va']), (0, ''))
|
|
|
|
|
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'))
|
|
|
|
|
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'))
|
|
|
|
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--no-high-entropy-va']),
|
|
|
|
|
(1, executable+': failed HIGH_ENTROPY_VA'))
|
|
|
|
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--high-entropy-va']),
|
|
|
|
|
(0, ''))
|
|
|
|
|
|
|
|
|
|
def test_MACHO(self):
|
|
|
|
|
source = 'test1.c'
|
|
|
|
|