x86/sgx: Add SGX infrastructure to recover from poison
authorTony Luck <tony.luck@intel.com>
Tue, 26 Oct 2021 22:00:47 +0000 (15:00 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Mon, 15 Nov 2021 19:13:16 +0000 (11:13 -0800)
commita495cbdffa30558b34f3c95555cecc4fd9688039
treed831c9c67c4e7827be5e7e301ddcbcfa2fdada28
parent992801ae92431761b3d8ec88abd5793d154d34ac
x86/sgx: Add SGX infrastructure to recover from poison

Provide a recovery function sgx_memory_failure(). If the poison was
consumed synchronously then send a SIGBUS. Note that the virtual
address of the access is not included with the SIGBUS as is the case
for poison outside of SGX enclaves. This doesn't matter as addresses
of code/data inside an enclave is of little to no use to code executing
outside the (now dead) enclave.

Poison found in a free page results in the page being moved from the
free list to the per-node poison page list.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lkml.kernel.org/r/20211026220050.697075-5-tony.luck@intel.com
arch/x86/kernel/cpu/sgx/main.c