archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <>
To: Linus Torvalds <>
Cc: the arch/x86 maintainers <>,
	LKML <>
Subject: [GIT PULL] x86/sgx for v5.19
Date: Mon, 23 May 2022 10:23:52 -0700	[thread overview]
Message-ID: <> (raw)

Hi Linus,

It's my first pull request, signing tags and all that jazz.  I hope I didn't
botch anything too badly.  Here we go:

Please pull a set of x86/sgx patches to fix crashes under SGX memory pressure.


The following changes since commit 42226c989789d8da4af1de0c31070c96726d990c:

  Linux 5.18-rc7 (2022-05-15 18:08:58 -0700)

are available in the Git repository at: tags/x86_sgx_for_v5.19_rc1

for you to fetch changes up to e3a3bbe3e99de73043a1d32d36cf4d211dc58c7e:

  x86/sgx: Ensure no data in PCMD page after truncate (2022-05-16 15:17:57 -0700)

A set of patches to prevent crashes in SGX enclaves under heavy memory

SGX uses normal RAM allocated from special shmem files as backing storage
when it runs out of SGX memory (EPC).  The code was overly aggressive when
freeing shmem pages and was inadvertently freeing perfectly good data.
This resulted in failures in the SGX instructions used to swap data back
into SGX memory.

This turned out to be really hard to trigger in mainline.  It was
originally encountered testing the out-of-tree "SGX2" patches, but later
reproduced on mainline.

Fix the data loss by being more careful about truncating pages out of
the backing storage and more judiciously setting pages dirty.

Reinette Chatre (5):
      x86/sgx: Disconnect backing page references from dirty status
      x86/sgx: Mark PCMD page as dirty when modifying contents
      x86/sgx: Obtain backing storage page with enclave mutex held
      x86/sgx: Fix race between reclaimer and page fault handler
      x86/sgx: Ensure no data in PCMD page after truncate

 arch/x86/kernel/cpu/sgx/encl.c | 113 +++++++++++++++++++++++++++++++++++++----
 arch/x86/kernel/cpu/sgx/encl.h |   2 +-
 arch/x86/kernel/cpu/sgx/main.c |  13 +++--
 3 files changed, 114 insertions(+), 14 deletions(-)

             reply	other threads:[~2022-05-23 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 17:23 Dave Hansen [this message]
2022-05-24  3:36 ` [GIT PULL] x86/sgx for v5.19 Linus Torvalds
2022-05-24  4:27 ` pr-tracker-bot

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).