Re: [PATCH] x86/sgx: Add poison handling to reclaimer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux