[Pal/Linux-SGX] Do not overwrite sgx.static_address in manifest

Previously, the "sgx.static_address" field was overwritten by the
pal-sgx-sign tool in the manifest, even if the manifest author
explicitly specified it as 0 or 1. Sometimes, it is important to keep
sgx.static_address as the manifest author intended. This commit adds a
check to overwrite sgx.static_address only if not specified in manifest.
This commit is contained in:
Dmitrii Kuvaiskii
2019-10-15 17:26:11 -07:00
parent aac7a83037
commit a17b28a656
+8 -6
View File
@@ -842,12 +842,14 @@ def main_sign(args):
# Try populate memory areas
memory_areas = get_memory_areas(attr, args)
if any([a.addr is not None for a in memory_areas]):
manifest['sgx.static_address'] = '1'
else:
global enclave_heap_min
enclave_heap_min = 0
manifest['sgx.static_address'] = '0'
if manifest.get('sgx.static_address', None) is None:
# If static_address is not specified explicitly, deduce from executable
if any([a.addr is not None for a in memory_areas]):
manifest['sgx.static_address'] = '1'
else:
global enclave_heap_min
enclave_heap_min = 0
manifest['sgx.static_address'] = '0'
# Add manifest at the top
shutil.copy2(args['manifest'], args['output'])