Skip to content

Commit 3df6070

Browse files
fanquaketheuni
authored andcommitted
contrib: remove macOS lazy_bind check
In future, this will be replaced by a check for fixup_chains usage.
1 parent 9bc357e commit 3df6070

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

contrib/devtools/security-check.py

-8
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,6 @@ def check_MACHO_NOUNDEFS(binary) -> bool:
158158
'''
159159
return binary.header.has(lief.MachO.HEADER_FLAGS.NOUNDEFS)
160160

161-
def check_MACHO_LAZY_BINDINGS(binary) -> bool:
162-
'''
163-
Check for no lazy bindings.
164-
We don't use or check for MH_BINDATLOAD. See #18295.
165-
'''
166-
return binary.dyld_info.lazy_bind == (0,0)
167-
168161
def check_MACHO_Canary(binary) -> bool:
169162
'''
170163
Check for use of stack canary
@@ -214,7 +207,6 @@ def check_MACHO_control_flow(binary) -> bool:
214207

215208
BASE_MACHO = [
216209
('NOUNDEFS', check_MACHO_NOUNDEFS),
217-
('LAZY_BINDINGS', check_MACHO_LAZY_BINDINGS),
218210
('Canary', check_MACHO_Canary),
219211
]
220212

contrib/devtools/test-security-check.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ def test_MACHO(self):
120120

121121
if arch == lief.ARCHITECTURES.X86:
122122
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector']),
123-
(1, executable+': failed NOUNDEFS LAZY_BINDINGS Canary PIE NX CONTROL_FLOW'))
123+
(1, executable+': failed NOUNDEFS Canary PIE NX CONTROL_FLOW'))
124124
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fstack-protector-all']),
125-
(1, executable+': failed NOUNDEFS LAZY_BINDINGS PIE NX CONTROL_FLOW'))
125+
(1, executable+': failed NOUNDEFS PIE NX CONTROL_FLOW'))
126126
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fstack-protector-all']),
127-
(1, executable+': failed NOUNDEFS LAZY_BINDINGS PIE CONTROL_FLOW'))
127+
(1, executable+': failed NOUNDEFS PIE CONTROL_FLOW'))
128128
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all']),
129-
(1, executable+': failed LAZY_BINDINGS PIE CONTROL_FLOW'))
129+
(1, executable+': failed PIE CONTROL_FLOW'))
130130
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all']),
131131
(1, executable+': failed PIE CONTROL_FLOW'))
132132
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 @@ def test_MACHO(self):
136136
else:
137137
# arm64 darwin doesn't support non-PIE binaries, control flow or executable stacks
138138
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fno-stack-protector']),
139-
(1, executable+': failed NOUNDEFS LAZY_BINDINGS Canary'))
139+
(1, executable+': failed NOUNDEFS Canary'))
140140
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fstack-protector-all']),
141-
(1, executable+': failed NOUNDEFS LAZY_BINDINGS'))
142-
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all']),
143-
(1, executable+': failed LAZY_BINDINGS'))
141+
(1, executable+': failed NOUNDEFS'))
144142
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-bind_at_load','-fstack-protector-all']),
145143
(0, ''))
146144

0 commit comments

Comments
 (0)