x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd
mainline inclusion from mainline-v6.1-rc1 commit 133e049a category: bugfix bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I6X1FF CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=133e049a3f8c91b175029fb6a59b6039d5e79cba Intel-SIG: commit 133e049a x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd Incremental backporting patches for SGX on Intel Xeon platform. -------------------------------- Unsanitized pages trigger WARN_ON() unconditionally, which can panic the whole computer, if /proc/sys/kernel/panic_on_warn is set. In sgx_init(), if misc_register() fails or misc_register() succeeds but neither sgx_drv_init() nor sgx_vepc_init() succeeds, then ksgxd will be prematurely stopped. This may leave unsanitized pages, which will result a false warning. Refine __sgx_sanitize_pages() to return: 1. Zero when the sanitization process is complete or ksgxd has been requested to stop. 2. The number of unsanitized pages otherwise. Fixes: 51ab30eb ("x86/sgx: Replace section->init_laundry_list with sgx_dirty_page_list") Reported-by:Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by:
Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by:
Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by:
Reinette Chatre <reinette.chatre@intel.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-sgx/20220825051827.246698-1-jarkko@kernel.org/T/#u Link: https://lkml.kernel.org/r/20220906000221.34286-2-jarkko@kernel.org [ Zhiquan: amend commit log. ] Signed-off-by:
Zhiquan Li <zhiquan1.li@intel.com>
Loading
Please sign in to comment