All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH,RESEND] x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages()
@ 2020-11-18 21:39 Jarkko Sakkinen
  2020-11-19 10:42 ` [tip: x86/sgx] " tip-bot2 for Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Jarkko Sakkinen @ 2020-11-18 21:39 UTC (permalink / raw)
  To: x86
  Cc: linux-sgx, Jarkko Sakkinen, Haitao Huang, Dave Hansen, Borislav Petkov

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.

Reported-by: Haitao Huang <haitao.huang@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index 6d37117ac8a0..30aefc93a31d 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -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;
 		}
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: x86/sgx] x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages()
  2020-11-18 21:39 [PATCH,RESEND] x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages() Jarkko Sakkinen
@ 2020-11-19 10:42 ` tip-bot2 for Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Jarkko Sakkinen @ 2020-11-19 10:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Haitao Huang, Jarkko Sakkinen, Borislav Petkov, x86, linux-kernel

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 <jarkko@kernel.org>
AuthorDate:    Wed, 18 Nov 2020 23:39:32 +02:00
Committer:     Borislav Petkov <bp@suse.de>
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.

Reported-by: Haitao Huang <haitao.huang@intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201118213932.63341-1-jarkko@kernel.org
---
 arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index 6d37117..30aefc9 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -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;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-19 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 21:39 [PATCH,RESEND] x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages() Jarkko Sakkinen
2020-11-19 10:42 ` [tip: x86/sgx] " tip-bot2 for Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.