mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-19 16:30:50 +02:00
scripts: add MACHO lazy bindings check to security-check.py
This commit is contained in:
parent
c8971547d9
commit
5ca90f8b59
@ -206,6 +206,23 @@ def check_MACHO_NX(executable) -> bool:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def check_MACHO_LAZY_BINDINGS(executable) -> bool:
|
||||||
|
'''
|
||||||
|
Check for no lazy bindings.
|
||||||
|
We don't use or check for MH_BINDATLOAD. See #18295.
|
||||||
|
'''
|
||||||
|
p = subprocess.Popen([OTOOL_CMD, '-l', executable], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, universal_newlines=True)
|
||||||
|
(stdout, stderr) = p.communicate()
|
||||||
|
if p.returncode:
|
||||||
|
raise IOError('Error opening file')
|
||||||
|
|
||||||
|
for line in stdout.splitlines():
|
||||||
|
tokens = line.split()
|
||||||
|
if 'lazy_bind_off' in tokens or 'lazy_bind_size' in tokens:
|
||||||
|
if tokens[1] != '0':
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
CHECKS = {
|
CHECKS = {
|
||||||
'ELF': [
|
'ELF': [
|
||||||
('PIE', check_ELF_PIE),
|
('PIE', check_ELF_PIE),
|
||||||
@ -221,7 +238,8 @@ CHECKS = {
|
|||||||
'MACHO': [
|
'MACHO': [
|
||||||
('PIE', check_MACHO_PIE),
|
('PIE', check_MACHO_PIE),
|
||||||
('NOUNDEFS', check_MACHO_NOUNDEFS),
|
('NOUNDEFS', check_MACHO_NOUNDEFS),
|
||||||
('NX', check_MACHO_NX)
|
('NX', check_MACHO_NX),
|
||||||
|
('LAZY_BINDINGS', check_MACHO_LAZY_BINDINGS)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user