[PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion"

From: Haitao Huang
Date: Thu Oct 26 2023 - 18:56:34 EST


This reverts commit 6b7b71a70af6d75e0a9eddf4b01e4383a78b8a5e.
That patch was a mistake.

link: https://lore.kernel.org/all/op.2dfkbh2iwjvjmi@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Signed-off-by: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx>
---
Sorry for the trouble. Please use this to revert or drop it from the
the tip/x86/urgent branch.
---
arch/x86/kernel/cpu/sgx/encl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
index d13b7e4ad0f5..279148e72459 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -322,7 +322,7 @@ struct sgx_encl_page *sgx_encl_load_page(struct sgx_encl *encl,
* ENCLS[EAUG] instruction.
*
* Returns: Appropriate vm_fault_t: VM_FAULT_NOPAGE when PTE was installed
- * successfully, VM_FAULT_SIGBUS as error otherwise.
+ * successfully, VM_FAULT_SIGBUS or VM_FAULT_OOM as error otherwise.
*/
static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma,
struct sgx_encl *encl, unsigned long addr)
@@ -348,7 +348,7 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma,
secinfo_flags = SGX_SECINFO_R | SGX_SECINFO_W | SGX_SECINFO_X;
encl_page = sgx_encl_page_alloc(encl, addr - encl->base, secinfo_flags);
if (IS_ERR(encl_page))
- return VM_FAULT_SIGBUS;
+ return VM_FAULT_OOM;

mutex_lock(&encl->lock);

--
2.25.1