Skip to content

x86/sgx: Misc page related fixes

Sean Christopherson linux-sgx 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 0 repliesNew
  2. v19 patches 7 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9x86/sgx: WARN once if an enclave is released with unfreed EPC pagesarch/x86/kernel/cpu/sgx/encl.c+1 -00 replies
2/9x86/sgx: Do not EWB SECS if the enclave is deadarch/x86/kernel/cpu/sgx/encl.c arch/x86/kernel/cpu/sgx/reclaim.c+16 -90 replies
3/9x86/sgx: Fix a memory leak in sgx_encl_destroy()arch/x86/kernel/cpu/sgx/encl.c+12 -70 replies
4/9x86/sgx: WARN on any non-zero return from __eremove()arch/x86/kernel/cpu/sgx/main.c+1 -10 replies
5/9x86/sgx: WARN only once if EREMOVE failsarch/x86/kernel/cpu/sgx/main.c+1 -10 replies
6/9x86/sgx: Split second half of sgx_free_page() to a separate helperarch/x86/kernel/cpu/sgx/main.c arch/x86/kernel/cpu/sgx/sgx.h+35 -100 replies
7/9x86/sgx: Use the post-reclaim variant of __sgx_free_page()arch/x86/kernel/cpu/sgx/encl.c arch/x86/kernel/cpu/sgx/ioctl.c arch/x86/kernel/cpu/sgx/reclaim.c+9 -90 replies
8/9x86/sgx: Don't update free page count if EPC section allocation failsarch/x86/kernel/cpu/sgx/main.c+2 -10 replies
9/9x86/sgx: Reinstate per EPC section free page countsarch/x86/kernel/cpu/sgx/main.c arch/x86/kernel/cpu/sgx/reclaim.c arch/x86/kernel/cpu/sgx/sgx.h+24 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH for_v23 v2 0/9] x86/sgx: Misc page related fixes

Two critical bug fixes for a memory leak in sgx_encl_destroy() and a livelock due to the EPC page free count getting corrupted. The rest of the patches are minor bug fixes and enhancements I collected in the process of hunting down the livelock.

v2: Fully fix the memory leak, which was hilariously worse than originally
thought. Fun fact, the leak has existed since v18, i.e. nearly a year.

Sean Christopherson (9):
x86/sgx: WARN once if an enclave is released with unfreed EPC pages x86/sgx: Do not EWB SECS if the enclave is dead
x86/sgx: Fix a memory leak in sgx_encl_destroy()
x86/sgx: WARN on any non-zero return from __eremove() x86/sgx: WARN only once if EREMOVE fails
x86/sgx: Split second half of sgx_free_page() to a separate helper x86/sgx: Use the post-reclaim variant of __sgx_free_page() x86/sgx: Don't update free page count if EPC section allocation fails x86/sgx: Reinstate per EPC section free page counts

 arch/x86/kernel/cpu/sgx/encl.c    | 34 ++++++++++++-------
 arch/x86/kernel/cpu/sgx/ioctl.c   |  6 ++--
 arch/x86/kernel/cpu/sgx/main.c    | 54 ++++++++++++++++++++++---------
 arch/x86/kernel/cpu/sgx/reclaim.c | 25 +++++++-------
 arch/x86/kernel/cpu/sgx/sgx.h     | 19 ++++++++++-
 5 files changed, 96 insertions(+), 42 deletions(-)
Signature · 1 line
2.22.0