x86/sgx: Fine-tune page adding flow
PATCH 1/1 x86/sgx: Fine-tune page adding flow
Make semantics follow more closely read()-syscall:
- A signal when nothing is yet processed results -EINTR.
- A signal when at least one page is processed results the length of the data processed.
Cc Borislav Petkov <[email protected]>
Cc Sean Christopherson <[email protected]>
Cc Haitao Huang <[email protected]>
Signed-off-by Jarkko Sakkinen <[email protected]>
--- arch/x86/kernel/cpu/sgx/ioctl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/sgx/ioctl.c +6 -1
@@ -530,7 +530,12 @@ static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)return -EINVAL ;for (c =0 ; c < addp.length; c +=PAGE_SIZE ) { -if (c ==SGX_MAX_ADD_PAGES_LENGTH ||signal_pending (current)) { +if (signal_pending (current)) { + ret = c ==0 ? -EINTR : c; +break ; + } + +if (c ==SGX_MAX_ADD_PAGES_LENGTH ) { ret = c;break ; }
Signature · 1 line
2.25.1