mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-09 01:40:27 +02:00
contrib: remove macOS lazy_bind check
In future, this will be replaced by a check for fixup_chains usage.
This commit is contained in:
@ -158,13 +158,6 @@ def check_MACHO_NOUNDEFS(binary) -> bool:
|
|||||||
'''
|
'''
|
||||||
return binary.header.has(lief.MachO.HEADER_FLAGS.NOUNDEFS)
|
return binary.header.has(lief.MachO.HEADER_FLAGS.NOUNDEFS)
|
||||||
|
|
||||||
def check_MACHO_LAZY_BINDINGS(binary) -> bool:
|
|
||||||
'''
|
|
||||||
Check for no lazy bindings.
|
|
||||||
We don't use or check for MH_BINDATLOAD. See #18295.
|
|
||||||
'''
|
|
||||||
return binary.dyld_info.lazy_bind == (0,0)
|
|
||||||
|
|
||||||
def check_MACHO_Canary(binary) -> bool:
|
def check_MACHO_Canary(binary) -> bool:
|
||||||
'''
|
'''
|
||||||
Check for use of stack canary
|
Check for use of stack canary
|
||||||
@ -214,7 +207,6 @@ BASE_PE = [
|
|||||||
|
|
||||||
BASE_MACHO = [
|
BASE_MACHO = [
|
||||||
('NOUNDEFS', check_MACHO_NOUNDEFS),
|
('NOUNDEFS', check_MACHO_NOUNDEFS),
|
||||||
('LAZY_BINDINGS', check_MACHO_LAZY_BINDINGS),
|
|
||||||
('Canary', check_MACHO_Canary),
|
('Canary', check_MACHO_Canary),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -120,13 +120,13 @@ class TestSecurityChecks(unittest.TestCase):
|
|||||||
|
|
||||||
if arch == lief.ARCHITECTURES.X86:
|
if arch == lief.ARCHITECTURES.X86:
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector']),
|
||||||
(1, executable+': failed NOUNDEFS LAZY_BINDINGS Canary PIE NX CONTROL_FLOW'))
|
(1, executable+': failed NOUNDEFS Canary PIE NX CONTROL_FLOW'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fstack-protector-all']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fstack-protector-all']),
|
||||||
(1, executable+': failed NOUNDEFS LAZY_BINDINGS PIE NX CONTROL_FLOW'))
|
(1, executable+': failed NOUNDEFS PIE NX CONTROL_FLOW'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fstack-protector-all']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fstack-protector-all']),
|
||||||
(1, executable+': failed NOUNDEFS LAZY_BINDINGS PIE CONTROL_FLOW'))
|
(1, executable+': failed NOUNDEFS PIE CONTROL_FLOW'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all']),
|
||||||
(1, executable+': failed LAZY_BINDINGS PIE CONTROL_FLOW'))
|
(1, executable+': failed PIE CONTROL_FLOW'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all']),
|
||||||
(1, executable+': failed PIE CONTROL_FLOW'))
|
(1, executable+': failed PIE CONTROL_FLOW'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all', '-fcf-protection=full']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all', '-fcf-protection=full']),
|
||||||
@ -136,11 +136,9 @@ class TestSecurityChecks(unittest.TestCase):
|
|||||||
else:
|
else:
|
||||||
# arm64 darwin doesn't support non-PIE binaries, control flow or executable stacks
|
# arm64 darwin doesn't support non-PIE binaries, control flow or executable stacks
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fno-stack-protector']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fno-stack-protector']),
|
||||||
(1, executable+': failed NOUNDEFS LAZY_BINDINGS Canary'))
|
(1, executable+': failed NOUNDEFS Canary'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fstack-protector-all']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fstack-protector-all']),
|
||||||
(1, executable+': failed NOUNDEFS LAZY_BINDINGS'))
|
(1, executable+': failed NOUNDEFS'))
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all']),
|
|
||||||
(1, executable+': failed LAZY_BINDINGS'))
|
|
||||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-bind_at_load','-fstack-protector-all']),
|
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-bind_at_load','-fstack-protector-all']),
|
||||||
(0, ''))
|
(0, ''))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user