-
Notifications
You must be signed in to change notification settings - Fork 554
EDMM user space support for kernel interfaces #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
This avoids a 3-way deadlock for later EMM implementation. The utility thread is inside enclave setting up TCS, waiting on mm_lock to commit SSA, etc. Another thread #PF inside sgx_mm functions with mm_lock held, trigger vDSO user handler which tries to get back into enclave via Enclave::ecall, which calls acquire_thread trying to get the m_thread_mutex of CThreadPool A newly created pthread making ecall also tries to acquire_thread holding the CThreadPool::m_thread_mutex will wait for the utility thread to finish allocating TCS. For user handler already has the TCS for current thread, directly use it to enter enclave. Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
Add a runtime agnostic enclave memory manager implementation in sdk/emm. The EMM APIs are based on design proposed in this PR: openenclave/openenclave#3991 Enclave common loader changes are in psw/enclave_common/sgx_mm_ocalls.cpp, which are basically OCall support needed for EMM. Intel SDK runtime specific support are implemented as runtime abstraction layer: sdk/trts/ema_rt.c Current limitations, steps to build and test are documented in sdk/emm/README.md Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com> Signed-off-by: Xiaofeng Xu <20158212+xxu36@users.noreply.github.com>
Another concern is about the dealloc function, in this case: |
per my understanding, the ema node should only exist during the enclave's lifetime, i.e., created/intiliazed on enclave initialization, and released on enclave_destroy, check the code, is there anywhere "destory_ema_root" invoked when enclave is destoryed? |
It's similar to how mmap works, if user does not track and remove, EMAs(like VMAs) will be kept until enclave dies (like process dies). |
Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
The ioctl numbers for EDMM functions are shifted in upstream patches: https://patchwork.kernel.org/project/intel-sgx/cover/cover.1638381245.git.reinette.chatre@intel.com/ Change those definitions accordingly in isgx_user.h Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
Kernel patch updated to v2: https://github.com/rchatre/linux/tree/sgx/sgx2_submitted_v2_plus_rwx |
This implementation includes:
Please refer to sdk/emm/README.md for a quick guide on build and test as well as a summary of current limitations: