From a17b28a65645a9dace93f53afa71d57fdac83243 Mon Sep 17 00:00:00 2001 From: Dmitrii Kuvaiskii Date: Fri, 11 Oct 2019 19:24:09 -0700 Subject: [PATCH] [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. --- Pal/src/host/Linux-SGX/signer/pal-sgx-sign | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Pal/src/host/Linux-SGX/signer/pal-sgx-sign b/Pal/src/host/Linux-SGX/signer/pal-sgx-sign index cc95cb25..fec0a987 100755 --- a/Pal/src/host/Linux-SGX/signer/pal-sgx-sign +++ b/Pal/src/host/Linux-SGX/signer/pal-sgx-sign @@ -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'])