x86 fixes
Linus,
Please pull the latest x86/urgent git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2023-10-01
# HEAD: c6c2adcba50c2622ed25ba5d5e7f05f584711358 x86/sgx: Resolves SECS reclaim vs. page fault for EAUG race
Misc fixes: a kerneldoc build warning fix, add SRSO mitigation for AMD-derived Hygon processors, and fix a SGX kernel crash in the page fault handler that can trigger when ksgxd races to reclaim the SECS special page, by making the SECS page unswappable.
Thanks,
Ingo
------------------>
Christophe JAILLET (1):
x86/kgdb: Fix a kerneldoc warning when build with W=1
Haitao Huang (1):
x86/sgx: Resolves SECS reclaim vs. page fault for EAUG race
Pu Wen (1):
x86/srso: Add SRSO mitigation for Hygon processors
arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/sgx/encl.c | 30 +++++++++++++++++++++++++----- arch/x86/kernel/kgdb.c | 1 - 3 files changed, 26 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -1303,7 +1303,7 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {VULNBL_AMD (0x15 ,RETBLEED ),VULNBL_AMD (0x16 ,RETBLEED ),VULNBL_AMD (0x17 ,RETBLEED |SMT_RSB |SRSO ), -VULNBL_HYGON (0x18 ,RETBLEED |SMT_RSB ), +VULNBL_HYGON (0x18 ,RETBLEED |SMT_RSB |SRSO ), VULNBL_AMD(0x19, SRSO), {} };
arch/x86/kernel/cpu/sgx/encl.c +25 -5
@@ -235,6 +235,21 @@ static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page,return epc_page; } +/* +* Ensure the SECS page is not swapped out. Must be called with encl->lock +* to protect the enclave states including SECS and ensure the SECS page is +* not swapped out again while being used. +*/ +static struct sgx_epc_page *sgx_encl_load_secs (struct sgx_encl *encl) +{ +struct sgx_epc_page *epc_page = encl->secs.epc_page; + +if (!epc_page) + epc_page =sgx_encl_eldu (&encl->secs,NULL ); + +return epc_page; +} +static struct sgx_encl_page *__sgx_encl_load_page (struct sgx_encl *encl,struct sgx_encl_page *entry) {
@@ -248,11 +263,9 @@ static struct sgx_encl_page *__sgx_encl_load_page(struct sgx_encl *encl,return entry; } -if (!(encl->secs.epc_page)) { - epc_page =sgx_encl_eldu (&encl->secs,NULL ); -if (IS_ERR (epc_page)) -return ERR_CAST (epc_page); - } + epc_page =sgx_encl_load_secs (encl); +if (IS_ERR (epc_page)) +return ERR_CAST (epc_page); epc_page =sgx_encl_eldu (entry, encl->secs.epc_page);if (IS_ERR (epc_page))
@@ -339,6 +352,13 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma,mutex_lock (&encl->lock); + epc_page =sgx_encl_load_secs (encl); +if (IS_ERR (epc_page)) { +if (PTR_ERR (epc_page) == -EBUSY ) + vmret =VM_FAULT_NOPAGE ; + goto err_out_unlock; + } + epc_page =sgx_alloc_epc_page (encl_page, false);if (IS_ERR (epc_page)) {if (PTR_ERR (epc_page) == -EBUSY )
arch/x86/kernel/kgdb.c +0 -1
@@ -695,7 +695,6 @@ void kgdb_arch_exit(void) }/** -* * kgdb_skipexception - Bail out of KGDB when we've been triggered. * @exception: Exception vector number * @regs: Current &struct pt_regs.
The pull request you sent on Sun, 1 Oct 2023 11:04:43 +0200:
The pull request you sent on Sun, 1 Oct 2023 11:04:43 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitx86-urgent-2023-10-01
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ec8c298121e3616f8013d3cf1db9c7169c9b0b2d
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html