[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <91fd3b35-b791-af37-6663-9c37055f339e@intel.com>
Date: Wed, 16 Feb 2022 16:25:24 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: <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 V3] x86/sgx: Add poison handling to reclaimer
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@...nel.org>
> Signed-off-by: Reinette Chatre <reinette.chatre@...el.com>
Could you please consider this fix for inclusion?
Thank you very much
Reinette
Powered by blists - more mailing lists