public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [tip: x86/urgent] x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion
@ 2023-10-20  8:10 tip-bot2 for Haitao Huang
  2023-10-26 22:55 ` [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion" Haitao Huang
  0 siblings, 1 reply; 4+ messages in thread
From: tip-bot2 for Haitao Huang @ 2023-10-20  8:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Haitao Huang, Ingo Molnar, stable, #, v6.0+, x86, linux-kernel

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     6b7b71a70af6d75e0a9eddf4b01e4383a78b8a5e
Gitweb:        https://git.kernel.org/tip/6b7b71a70af6d75e0a9eddf4b01e4383a78b8a5e
Author:        Haitao Huang <haitao.huang@linux.intel.com>
AuthorDate:    Thu, 19 Oct 2023 19:53:53 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 20 Oct 2023 10:05:48 +02:00

x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion

In the EAUG on page fault path, VM_FAULT_OOM is returned when the
Enclave Page Cache (EPC) runs out. This may trigger unneeded OOM kill
that will not free any EPCs. Return VM_FAULT_SIGBUS instead.

Fixes: 5a90d2c3f5ef ("x86/sgx: Support adding of pages to an initialized enclave")
Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org # v6.0+
---
 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 279148e..d13b7e4 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 or VM_FAULT_OOM as error otherwise.
+ * successfully, VM_FAULT_SIGBUS 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_OOM;
+		return VM_FAULT_SIGBUS;
 
 	mutex_lock(&encl->lock);
 

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

* [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion"
  2023-10-20  8:10 [tip: x86/urgent] x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion tip-bot2 for Haitao Huang
@ 2023-10-26 22:55 ` Haitao Huang
  2023-10-26 22:58   ` kernel test robot
  2023-10-27 17:21   ` Dave Hansen
  0 siblings, 2 replies; 4+ messages in thread
From: Haitao Huang @ 2023-10-26 22:55 UTC (permalink / raw)
  To: tip-bot2
  Cc: #, haitao.huang, linux-kernel, linux-tip-commits, mingo, stable,
	v6.0+, x86

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

link: https://lore.kernel.org/all/op.2dfkbh2iwjvjmi@hhuan26-mobl.amr.corp.intel.com/

Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
---
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


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

* Re: [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion"
  2023-10-26 22:55 ` [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion" Haitao Huang
@ 2023-10-26 22:58   ` kernel test robot
  2023-10-27 17:21   ` Dave Hansen
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2023-10-26 22:58 UTC (permalink / raw)
  To: Haitao Huang; +Cc: stable, oe-kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion"
Link: https://lore.kernel.org/stable/20231026225528.5738-1-haitao.huang%40linux.intel.com

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




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

* Re: [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion"
  2023-10-26 22:55 ` [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion" Haitao Huang
  2023-10-26 22:58   ` kernel test robot
@ 2023-10-27 17:21   ` Dave Hansen
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Hansen @ 2023-10-27 17:21 UTC (permalink / raw)
  To: Haitao Huang, tip-bot2
  Cc: #, linux-kernel, linux-tip-commits, mingo, stable, v6.0+, x86

On 10/26/23 15:55, Haitao Huang wrote:
> This reverts commit 6b7b71a70af6d75e0a9eddf4b01e4383a78b8a5e. That patch
> was a mistake. link:
> https://lore.kernel.org/all/op.2dfkbh2iwjvjmi@hhuan26-mobl.amr.corp.intel.com/

Thanks for the patch.  There was only one trivial commit on top, so I
just dropped your commit and effectively rebased the other single one
instead of applying a revert.

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

end of thread, other threads:[~2023-10-27 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20  8:10 [tip: x86/urgent] x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion tip-bot2 for Haitao Huang
2023-10-26 22:55 ` [PATCH] Revert "x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion" Haitao Huang
2023-10-26 22:58   ` kernel test robot
2023-10-27 17:21   ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox