Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sgx): handle CSSA 0-3 with 2 sallyport blocks
CSSA 1 and 2 get their own block. CSSA 0 and 3 don't need a block. Normal block usage looks like this: * Enclave CSSA 0 fills in registers and executes syscall op. * Host sees exception, calls CSSA 1 with sallyport block 0. * Enclave CSSA 1 fills in sallyport block, executes syscall op. * Host sees exception, handles sallyport block 0 and calls CSSA 2. * Enclave CSSA 2 confirms CSSA 1 syscall op and increases instruction pointer of CSSA 1. Exits to the host. * Host sees clean EEXIT of CSSA 2, calls CSSA 1. * Enclave CSSA 1 continues after syscall op and handles sallyport block 0, then increases CSSA 0 instruction pointer and exits to the host. * Host sees clean EEXIT of CSSA 1, calls CSSA 0. * Enclave CSSA 0 handles result of syscall. Now, if there was lazy memory allocation for CSSA 0, with page fault handling, the following situation could occur: While enclave CSSA 1 handles the result of sallyport block 0 and copies data back to the userspace memory, a page fault could occur. Therefore we need a second sallyport block, which could be uses by CSSA 2 to handle the page fault occuring in CSSA 1. This situation looks like this: * Enclave CSSA 0 fills in registers and executes syscall op. * Host sees exception, calls CSSA 1 with sallyport block 0. * Enclave CSSA 1 fills in sallyport block, executes syscall op. * Host sees exception, handles sallyport block 0 and calls CSSA 2. * Enclave CSSA 2 confirms CSSA 1 syscall op and increases instruction pointer of CSSA 1. Exits to the host. * Host sees clean EEXIT of CSSA 2, calls CSSA 1. * Enclave CSSA 1 continues after syscall op and handles sallyport block 0, and encountes a page fault for touching not yet mapped memory of CSSA 0. * Host sees page fault exception, calls CSSA 2. * CSSA 2 sees page fault exception, does some memory operations using sallyport block 1 and syscall op. * Host sees syscall exception, handles sallyport block 1 and calls CSSA 3. * Enclave CSSA 3 confirms CSSA 2 syscall op and increases instruction pointer of CSSA 2. Exits to the host. * Host sees clean EEXIT of CSSA 3, calls CSSA 2. * Enclave CSSA 2 continues after syscall op and handles sallyport block 1, then increases CSSA 1 instruction pointer and exits to the thost. * Host sees clean EEXIT of CSSA 2, calls CSSA 1. * Enclave CSSA 1 continues handling sallyport block 0, now that the page is correctly mapped, then increases CSSA 0 instruction pointer and exits to the host. * Host sees clean EEXIT of CSSA 1, calls CSSA 0. * Enclave CSSA 0 handles result of syscall. Signed-off-by: Harald Hoyer <harald@profian.com>
- Loading branch information
Showing
4 changed files
with
65 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters