[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9cefa244-9830-c158-6112-b2c61a464632@intel.com>
Date: Wed, 19 Jan 2022 11:51:05 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>, tony.luck@...el.com,
dave.hansen@...ux.intel.com, jarkko@...nel.org, tglx@...utronix.de,
bp@...en8.de, luto@...nel.org, mingo@...hat.com,
linux-sgx@...r.kernel.org, x86@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/sgx: Add poison handling to reclaimer
On 1/18/22 3:05 PM, Reinette Chatre wrote:
> The machine check recovery handling in SGX added the changes
> listed below to the freeing of pages in sgx_free_epc_page().
> The SGX reclaimer contains an open coded version of
> sgx_free_epc_page() and thus did not obtain the changes in
> support of poison handling.
I was trying to decide if this is an urgent fix or not. A more crisp
problem statement might have helped in the changelog.
But, from what I can tell, the most probable troublesome scenario here
would be something like:
1. Machine check (#MC) occurs (asynchronous, !MF_ACTION_REQUIRED)
2. arch_memory_failure() called is eventually
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
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 if this patch is applied.
Basically, this patch ensures that a bad enclave page is isolated
quickly and causes a minimal amount of collateral damage. Is this a
valid summary?
The SGX reclaimer code lacks page poison handling in its free
path. This can lead to completely avoidable machine checks if a
poisoned page is freed and reallocated instead of being
isolated.
Powered by blists - more mailing lists