From: Jarkko Sakkinen <jarkko@kernel.org>
To: linux-sgx@vger.kernel.org
Cc: Haitao Huang <haitao.huang@linux.intel.com>,
Vijay Dhanraj <vijay.dhanraj@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT
AND 64-BIT))
Subject: [PATCH 2/6] x86/sgx: Handle VA page allocation failure for EAUG on PF.
Date: Tue, 30 Aug 2022 06:12:02 +0300 [thread overview]
Message-ID: <20220830031206.13449-3-jarkko@kernel.org> (raw)
In-Reply-To: <20220830031206.13449-1-jarkko@kernel.org>
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>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
v2:
* Removed reviewed-by, no other changes.
---
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.2
next prev parent reply other threads:[~2022-08-30 3:12 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 3:12 [PATCH 0/6] x86/sgx: Test and fixes Jarkko Sakkinen
2022-08-30 3:12 ` [PATCH 1/6] x86/sgx: Do not consider unsanitized pages an error Jarkko Sakkinen
2022-08-30 22:54 ` Reinette Chatre
2022-08-31 1:27 ` Huang, Kai
2022-08-31 2:15 ` jarkko
2022-08-31 2:35 ` Huang, Kai
2022-08-31 2:44 ` jarkko
2022-08-31 2:55 ` Huang, Kai
2022-08-31 2:57 ` jarkko
2022-08-31 3:10 ` Jarkko Sakkinen
2022-08-31 3:28 ` Huang, Kai
2022-08-31 3:40 ` jarkko
2022-08-31 3:17 ` Huang, Kai
2022-08-31 15:18 ` Haitao Huang
2022-08-31 18:28 ` jarkko
2022-08-31 18:35 ` Dave Hansen
2022-08-31 18:44 ` jarkko
2022-08-31 18:45 ` jarkko
2022-08-31 20:42 ` Huang, Kai
2022-09-01 22:27 ` jarkko
2022-09-01 22:41 ` Huang, Kai
2022-09-01 23:58 ` jarkko
2022-09-02 0:26 ` Huang, Kai
2022-08-31 1:55 ` Jarkko Sakkinen
2022-08-31 1:58 ` Jarkko Sakkinen
2022-08-31 2:01 ` Jarkko Sakkinen
2022-08-31 18:08 ` Reinette Chatre
2022-08-30 3:12 ` Jarkko Sakkinen [this message]
2022-08-30 22:54 ` [PATCH 2/6] x86/sgx: Handle VA page allocation failure for EAUG on PF Reinette Chatre
2022-08-30 3:12 ` [PATCH 3/6] selftests/sgx: Ignore OpenSSL 3.0 deprecated functions warning Jarkko Sakkinen
2022-08-30 18:18 ` Reinette Chatre
2022-08-31 1:07 ` Jarkko Sakkinen
2022-08-30 3:12 ` [PATCH 4/6] selftests/sgx: Add SGX selftest augment_via_eaccept_long Jarkko Sakkinen
2022-08-30 22:55 ` Reinette Chatre
2022-08-31 2:28 ` Jarkko Sakkinen
2022-08-31 18:09 ` Reinette Chatre
2022-09-01 22:16 ` Jarkko Sakkinen
2022-09-01 23:11 ` Reinette Chatre
2022-09-02 0:00 ` Jarkko Sakkinen
2022-09-02 0:02 ` Jarkko Sakkinen
2022-08-30 3:12 ` [PATCH 5/6] selftests/sgx: retry the ioctls returned with EAGAIN Jarkko Sakkinen
2022-08-30 22:56 ` Reinette Chatre
2022-08-31 2:31 ` Jarkko Sakkinen
2022-08-31 18:09 ` Reinette Chatre
2022-09-01 22:17 ` Jarkko Sakkinen
2022-08-31 18:14 ` Dave Hansen
2022-09-01 22:18 ` Jarkko Sakkinen
2022-08-30 3:12 ` [PATCH 6/6] selftests/sgx: Add a bpftrace script for tracking allocation errors Jarkko Sakkinen
2022-08-30 22:57 ` Reinette Chatre
2022-08-31 2:33 ` Jarkko Sakkinen
2022-08-31 18:10 ` Reinette Chatre
2022-08-31 18:23 ` Jarkko Sakkinen
2022-08-31 18:23 ` Dave Hansen
2022-09-01 22:20 ` Jarkko Sakkinen
2022-09-01 22:34 ` Dave Hansen
2022-09-01 23:55 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830031206.13449-3-jarkko@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
--cc=vijay.dhanraj@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox