Skip to contentSkip to conversation

x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages()

PATCH RESEND Applied Jarkko Sakkinen 2 participants 2 messages Nov 18, 2020 – Nov 19, 2020

Subsystems (2)
lore
Share & tools
lore

Jarkko Sakkinen

author maintainer
#0 lore raw

PATCH RESEND 1/1 x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages()

Return -ERESTARTSYS instead of -EINTR in sgx_ioc_enclave_add_pages() when interrupted before any pages have been processed. At this point ioctl can be obviously safely restarted.

---
 arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/sgx/ioctl.c +1 -1
index 6d37117ac8a0..30aefc93a31d 100644
@@ -444,7 +444,7 @@ static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)
 	for (c = 0 ; c < add_arg.length; c += PAGE_SIZE) {
 		if (signal_pending(current)) {
 			if (!c)
-				ret = -EINTR;
+				ret = -ERESTARTSYS;
 
 			break;
 		}
Signature · 1 line
2.27.0
#1 lore raw
The following commit has been merged into the x86/sgx branch of tip:

The following commit has been merged into the x86/sgx branch of tip:

Commit-ID:     14132a5b807bb5caf778fe7ae1597e630971e949
Gitweb:        https://git.kernel.org/tip/14132a5b807bb5caf778fe7ae1597e630971e949
Author:        Jarkko Sakkinen <[email protected]>
AuthorDate:    Wed, 18 Nov 2020 23:39:32 +02:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Thu, 19 Nov 2020 10:51:24 +01:00

x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages()

Return -ERESTARTSYS instead of -EINTR in sgx_ioc_enclave_add_pages() when interrupted before any pages have been processed. At this point ioctl can be obviously safely restarted.

---
 arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/sgx/ioctl.c +1 -1
index 6d37117..30aefc9 100644
@@ -444,7 +444,7 @@ static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)
 	for (c = 0 ; c < add_arg.length; c += PAGE_SIZE) {
 		if (signal_pending(current)) {
 			if (!c)
-				ret = -EINTR;
+				ret = -ERESTARTSYS;
 
 			break;
 		}