Skip to content

Commit 2154e1c

Browse files
rchatrehansendc
authored andcommitted
x86/sgx: Mark PCMD page as dirty when modifying contents
Recent commit 08999b2 ("x86/sgx: Free backing memory after faulting the enclave page") expanded __sgx_encl_eldu() to clear an enclave page's PCMD (Paging Crypto MetaData) from the PCMD page in the backing store after the enclave page is restored to the enclave. Since the PCMD page in the backing store is modified the page should be marked as dirty to ensure the modified data is retained. Cc: stable@vger.kernel.org Fixes: 08999b2 ("x86/sgx: Free backing memory after faulting the enclave page") Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Tested-by: Haitao Huang <haitao.huang@intel.com> Link: https://lkml.kernel.org/r/00cd2ac480db01058d112e347b32599c1a806bc4.1652389823.git.reinette.chatre@intel.com
1 parent 6bd4296 commit 2154e1c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/x86/kernel/cpu/sgx/encl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static int __sgx_encl_eldu(struct sgx_encl_page *encl_page,
8484
}
8585

8686
memset(pcmd_page + b.pcmd_offset, 0, sizeof(struct sgx_pcmd));
87+
set_page_dirty(b.pcmd);
8788

8889
/*
8990
* The area for the PCMD in the page was zeroed above. Check if the

0 commit comments

Comments
 (0)