Explorar o código

[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.
Dmitrii Kuvaiskii %!s(int64=4) %!d(string=hai) anos
pai
achega
a17b28a656
Modificáronse 1 ficheiros con 8 adicións e 6 borrados
  1. 8 6
      Pal/src/host/Linux-SGX/signer/pal-sgx-sign

+ 8 - 6
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'])