mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-05 21:31:36 +00:00
[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:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user