linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/sgx: Handle VA page allocation failure for EAUG on PF.
@ 2022-08-15 23:38 Jarkko Sakkinen
  2022-08-15 23:39 ` [PATCH 2/2] selftests/sgx: Add SGX selftest augment_via_eaccept_long Jarkko Sakkinen
  0 siblings, 1 reply; 15+ messages in thread
From: Jarkko Sakkinen @ 2022-08-15 23:38 UTC (permalink / raw)
  To: Dave Hansen, linux-sgx
  Cc: Haitao Huang, Vijay Dhanraj, Jarkko Sakkinen, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	H. Peter Anvin, Reinette Chatre,
	open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)

From: Haitao Huang <haitao.huang@linux.intel.com>

VM_FAULT_NOPAGE is expected behaviour for -EBUSY failure path, when
augmenting a page, as this means that the reclaimer thread has been
triggered, and the intention is just to round-trip in ring-3, and
retry with a new page fault.

Fixes: 5a90d2c3f5ef ("x86/sgx: Support adding of pages to an initialized enclave")
Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
Tested-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
I rewrote the commit message because it was not explanatory enough,
added the missing fixes tag, and all cumulated tags.
 arch/x86/kernel/cpu/sgx/encl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
index 24c1bb8eb196..de92c1c8b79d 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -344,8 +344,11 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma,
 	}
 
 	va_page = sgx_encl_grow(encl, false);
-	if (IS_ERR(va_page))
+	if (IS_ERR(va_page)) {
+		if (PTR_ERR(va_page) == -EBUSY)
+			vmret =  VM_FAULT_NOPAGE;
 		goto err_out_epc;
+	}
 
 	if (va_page)
 		list_add(&va_page->list, &encl->va_pages);
-- 
2.37.1


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

end of thread, other threads:[~2022-08-25  1:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 23:38 [PATCH 1/2] x86/sgx: Handle VA page allocation failure for EAUG on PF Jarkko Sakkinen
2022-08-15 23:39 ` [PATCH 2/2] selftests/sgx: Add SGX selftest augment_via_eaccept_long Jarkko Sakkinen
2022-08-16 16:26   ` Reinette Chatre
2022-08-16 23:33     ` Jarkko Sakkinen
2022-08-16 23:37       ` Jarkko Sakkinen
2022-08-17  1:27       ` Dhanraj, Vijay
2022-08-17  4:35         ` Reinette Chatre
2022-08-17 14:44           ` Jarkko Sakkinen
2022-08-17 14:53             ` Jarkko Sakkinen
2022-08-17 15:43               ` Reinette Chatre
2022-08-17 16:36                 ` Jarkko Sakkinen
2022-08-17 16:14           ` Dhanraj, Vijay
2022-08-17 14:38         ` Jarkko Sakkinen
2022-08-17 15:39           ` Dhanraj, Vijay
2022-08-25  1:28             ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).