intel / intel/confidential-computing.sgx.sdk
Relocations in RO segment
- Dominant language
- C++
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Hey everyone!
**TLDR** some R_X86_64_RELATIVE relocation results in a memory protection fault during enclave initialization.
I have an enclave binary with some R_X86_64_RELATIVE relocations that belong to a R/E segment. The loader `mprotect`s the corresponding addresses as writable in `CLoader::build_mem_region` as expected, but then removes write accesses too soon by calling `CLoader::set_memory_protection(false)` before the enclave initialization, and hence before the `do_relocs` function has a chance to execute, resulting in a memory error.
It looks like the `mparser::set_memory_protection(bool)` does not take into account these pages when it loops over segments.
Thanks in advance,
Adrien
Contributor guide
Assessment
This issue has not been assessed yet.