Skip to content

Commit 20caab6

Browse files
committed
ae: blank out ld-linux.so interpretor path from AEs
The enclaves are getting built as ELF executables, and thus the linker will embed the current ld-linux.so path for the host OS environment in the binary: $ readelf -a libsgx_tdqe.signed.so | grep interpreter [Requesting program interpreter: /nix/store/xmprbk52mlcdsljz66m8yf7cf0xf36n1-glibc-2.38-44/lib/ld-linux-x86-64.so.2] The SGX enclaves are never loaded using ld-linux.so, as SGX has custom code for loading enclaves in the required manner. This embedded ld-linux.so path thus serves no functional purpose, while also making it harder to do a reproducible build of the enclaves outside of the NixOS environment. This patch blanks out the NixOX interpretor path, by setting it to the empty string. Related: intel/confidential-computing.sgx#1040 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
1 parent 2562057 commit 20caab6

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

QuoteGeneration/ae/buildenv.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ LDTFLAGS_NO_CRYPTO = -L$(SGX_LIBRARY_PATH) -Wl,--whole-archive $(TRTSLIB) -Wl,--
5858
-Wl,--start-group $(EXTERNAL_LIB_NO_CRYPTO) -Wl,--end-group \
5959
-Wl,--version-script=$(WORK_DIR)/enclave.lds $(ENCLAVE_LDFLAGS)
6060

61-
LDTFLAGS += -Wl,-Map=out.map -Wl,--undefined=version -Wl,--gc-sections
62-
LDTFLAGS_NO_CRYPTO += -Wl,-Map=out.map -Wl,--undefined=version -Wl,--gc-sections
61+
LDTFLAGS += -Wl,-Map=out.map -Wl,--undefined=version -Wl,--gc-sections -Wl,-dynamic-linker,
62+
LDTFLAGS_NO_CRYPTO += -Wl,-Map=out.map -Wl,--undefined=version -Wl,--gc-sections -Wl,-dynamic-linker,
6363

6464

6565
vpath %.cpp $(COMMON_DIR)/src:$(LINUX_PSW_DIR)/ae/common

QuoteVerification/QvE/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ ENCLAVE_LDFLAGS := -Wl,-z,relro,-z,now,-z,noexecstack -shared \
123123
-Wl,--build-id \
124124
-Wl,-Bdynamic -L$(SERVTD_ATTEST_BUILD_DIR) -ltdx_verify \
125125
-Wl,-L/lib/x86_64-linux-gnu/ -lc \
126-
-Wl,--version-script=Enclave/linux/qve_migration.lds
126+
-Wl,--version-script=Enclave/linux/qve_migration.lds \
127+
-Wl,--dynamic-linker,
127128
else
128129
ENCLAVE_LDFLAGS := -Wl,-z,relro,-z,now,-z,noexecstack -fPIC \
129130
-Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles \
@@ -135,7 +136,8 @@ ENCLAVE_LDFLAGS := -Wl,-z,relro,-z,now,-z,noexecstack -fPIC \
135136
-Wl,-pie,-eenclave_entry -Wl,--export-dynamic -Wl,-Map,qve.map \
136137
-Wl,--defsym,__ImageBase=0 \
137138
-Wl,--build-id \
138-
-Wl,--version-script=Enclave/linux/qve.lds
139+
-Wl,--version-script=Enclave/linux/qve.lds \
140+
-Wl,--dynamic-linker,
139141
endif
140142

141143

0 commit comments

Comments
 (0)