[...]
Additionally fix a similar race: user space converts a normal enclave page to a TCS page (via SGX_IOC_ENCLAVE_MODIFY_TYPES) on CPU1, and at the same time, user space performs a memory access on the same page on CPU2. This fix is not strictly necessary (this particular race would indicate a bug in a user space application), but it gives a consistent rule: if an enclave page is under certain operation by the kernel with the mapping removed, then other threads trying to access that page are temporarily blocked and should retry.
Fixes: 9849bb27152c ("x86/sgx: Support complete page removal") Cc: stable@vger.kernel.org Signed-off-by: Dmitrii Kuvaiskii dmitrii.kuvaiskii@intel.com
This also needs another Fixes tag:
Fixes: 45d546b8c109d ("x86/sgx: Support modifying SGX page type")
.. since this patch fixes two functions introduced by two patches.
Maybe it's better to split this into two patches with each have one Fixes tag, but I think it should also be fine to have two Fixes tags in this one patch (I've seen that before), because all SGX2 patches were merged together in the same kernel release.
Reviewed-by: Kai Huang kai.huang@intel.com