From: Reinette Chatre <reinette.chatre@intel.com>
To: <tony.luck@intel.com>, <dave.hansen@linux.intel.com>,
<jarkko@kernel.org>, <tglx@linutronix.de>, <bp@alien8.de>,
<luto@kernel.org>, <mingo@redhat.com>,
<linux-sgx@vger.kernel.org>, <x86@kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3] x86/sgx: Add poison handling to reclaimer
Date: Wed, 16 Feb 2022 16:25:24 -0800 [thread overview]
Message-ID: <91fd3b35-b791-af37-6663-9c37055f339e@intel.com> (raw)
In-Reply-To: <dcc95eb2aaefb042527ac50d0a50738c7c160dac.1643830353.git.reinette.chatre@intel.com>
Dear Maintainers,
On 2/2/2022 11:41 AM, Reinette Chatre wrote:
> The SGX reclaimer code lacks page poison handling in its main
> free path. This can lead to avoidable machine checks if a
> poisoned page is freed and reallocated instead of being
> isolated.
>
> A troublesome scenario is:
> 1. Machine check (#MC) occurs (asynchronous, !MF_ACTION_REQUIRED)
> 2. arch_memory_failure() is eventually called
> 3. (SGX) page->poison set to 1
> 4. Page is reclaimed
> 5. Page added to normal free lists by sgx_reclaim_pages()
> ^ This is the bug (poison pages should be isolated on the
> sgx_poison_page_list instead)
> 6. Page is reallocated by some innocent enclave, a second (synchronous)
> in-kernel #MC is induced, probably during EADD instruction.
> ^ This is the fallout from the bug
>
> (6) is unfortunate and can be avoided by replacing the open coded
> enclave page freeing code in the reclaimer with sgx_free_epc_page()
> to obtain support for poison page handling that includes placing the
> poisoned page on the correct list.
>
> Fixes: d6d261bded8a ("x86/sgx: Add new sgx_epc_page flag bit to mark free pages")
> Fixes: 992801ae9243 ("x86/sgx: Initial poison handling for dirty and free pages")
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Could you please consider this fix for inclusion?
Thank you very much
Reinette
next prev parent reply other threads:[~2022-02-17 0:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 19:41 [PATCH V3] x86/sgx: Add poison handling to reclaimer Reinette Chatre
2022-02-17 0:25 ` Reinette Chatre [this message]
2022-02-17 18:26 ` Dave Hansen
2022-02-17 18:47 ` Reinette Chatre
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91fd3b35-b791-af37-6663-9c37055f339e@intel.com \
--to=reinette.chatre@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).