Skip to content

Commit 81fa6fd

Browse files
haitaohuanghansendc
authored andcommitted
x86/sgx: Handle VA page allocation failure for EAUG on PF.
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: 5a90d2c ("x86/sgx: Support adding of pages to an initialized enclave") Signed-off-by: Haitao Huang <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Vijay Dhanraj <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 133e049 commit 81fa6fd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/x86/kernel/cpu/sgx/encl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,11 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma,
344344
}
345345

346346
va_page = sgx_encl_grow(encl, false);
347-
if (IS_ERR(va_page))
347+
if (IS_ERR(va_page)) {
348+
if (PTR_ERR(va_page) == -EBUSY)
349+
vmret = VM_FAULT_NOPAGE;
348350
goto err_out_epc;
351+
}
349352

350353
if (va_page)
351354
list_add(&va_page->list, &encl->va_pages);

0 commit comments

Comments
 (0)