Support build time setting of enclave load directory #437
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current code for loading enclaves (
pce
,id_enclave
,qe3
,tdqe
,qve
) tries to find the enclave file in the directory of the currently loaded library (as reported bydladdr
), or in the directory of the current executable (as reported by/proc/self/exe
).Neither of these approaches is sufficiently flexible to work with all Linux distro filesystem layout policies. In particular distros may desire to have a specific directory location exclusively for the shipping of enclaves, separate from any native libraries or executables.
This introduces support for an
"SGX_ENCLAVE_PATH"
variable in the makefiles, which is used to define anSGX_ENCLAVE_PATH
symbol in code.By default
SGX_ENCLAVE_PATH
path will get defined to an empty string at the C level and so current code behaviour will not be changed.If this is set though, then it will be used to locate the enclaves, with no fallback to searching relative to the library or binary.