From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16BEF606A31F for ; Sun, 6 Dec 2026 01:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hl+arc9L Received: by kanga.kvack.org (Postfix) id 192906B05B5; Sat, 5 Dec 2026 20:26:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 080E46B05B6; Sat, 5 Dec 2026 20:26:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E63996B05B7; Sat, 5 Dec 2026 20:26:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A2C3A6B05B5 for ; Sat, 5 Dec 2026 20:26:28 -0500 (EST) Received: from smtpin10.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1F9AF80758 for ; Sun, 6 Dec 2026 01:26:28 +0000 (UTC) X-FDA: 85511818056.10.613D1C5 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf11.hostedemail.com (Postfix) with ESMTP id 6798640008 for ; Sun, 6 Dec 2026 01:26:26 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=fail ("headers rsa verify failed") header.d=kernel.org header.s=k20260515 header.b=hl+arc9L; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796520386; b=w/m5Nk1W9lsSb7OuHDjmXcIVMDXhWwGKtlaYAAPX0mOVPXxqB08VQT+LvligpZnJiA4kbr 7IiTLapXPXqPYAbXijzRgeEUqQW1Mvt2z04vfgS9T/DdGZykIQWIp9oocuyQ/5O1Z2KaZc bYX3452ccb1FdBqVb31fMfS1iHa24GQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796520386; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VOA/G4cmdHrPGVhiBOIFGb2A3K3r6Y7QI0/tqqQZigU=; b=5eMgvI3EXD0OqFiZfv/Ul9qTqaacVDfp/k/jAsppxk+mo4k5JljQ3VyGtu5A175D2bsGxp h9H4hof6PFYLB1wCQ+mZA+Ca4+UmyahYI2E+sjfOS7Tsh6eTLIbwQQ4C6vVHvB/kkY4Mic JxlSpAoqtTFDCVs5yegqqXjlF54KeXc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=fail ("headers rsa verify failed") header.d=kernel.org header.s=k20260515 header.b=hl+arc9L; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id AE9B641827; Sun, 6 Dec 2026 01:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52C1C1F00A07; Sun, 6 Dec 2026 01:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796520385; bh=VOA/G4cmdHrPGVhiBOIFGb2A3K3r6Y7QI0/tqqQZigU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hl+arc9LLhZnDTKNFG1YplYs+tegvpF4zakP+bgs1yzu8jhwF2hT3vZbGPztFZSg9 IVhYNlmuYFUDU3JTT57MeiYBEWldrpZ64jIgmDffSkvUre0hab14LlSspPWAqWQHnq Kg6KVy2r6YPdKIWVOTMZHNu7XYSvKpBtcjgkNduXuspAH41U/Jjt2rl6sjiICXE2wV pzU7J4D6iexho3xIzvCTX2i3yYFboPxdPVp5mTFEoYQptTeUi9kU+z6VXgO1V7T7Hh IYfzLNHC45fPN99HGL5OIiGmTSJQXVHDeuz8yosJYPMqqiRpvUPjtM11XsNkEZz9Pp IY434TqssPccA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v16 4/9] arm64: enable recover from synchronous external abort in kernel context Reply-To: sashiko-reviews@lists.linux.dev To: "Jiangtian Feng" , catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, rafael@kernel.org Cc: mark.rutland@arm.com, james.morse@arm.com, robin.murphy@arm.com, nikumbh.adi@gmail.com, tony.luck@intel.com, guohanjun@huawei.com, mchehab@kernel.org, lenb@kernel.org, xueshuai@linux.alibaba.com, tongtiangen@huawei.com, tianruidong@linux.alibaba.com, tongweilin@linux.alibaba.com, baolin.wang@linux.alibaba.com, ashok.raj@oss.qualcomm.com, jonathan.cameron@oss.qualcomm.com, david@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, mhocko@suse.com, ljs@kernel.org, surenb@google.com, shivankg@amd.com, wangkefeng.wang@huawei.com, xiangzao@linux.alibaba.com, ying.huang@linux.alibaba.com, linmiaohe@huawei.com, nao.horiguchi@gmail.com, ziy@nvidia.com, tujinjiang@huawei.com, mgorman@techsingularity.net, kaitao.cheng@linux.dev, chengkaitao@kylinos.cn, muchun.song@linux.dev, nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev, kas@kernel.org, kees@kernel.org, andreyknvl@gmail.com, dvyukov@google.com, gli@kvack.org, der@google.com, ryabinin.a.a@gmail.com, vincenzo.frascino@arm.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com, aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com, linux-mm@kvack.org, kasan-dev@googlegroups.com, x86@kernel.org In-Reply-To: <20261205012435.1406255-5-jiangtianfeng@linux.alibaba.com> References: <20261205012435.1406255-1-jiangtianfeng@linux.alibaba.com> <20261205012435.1406255-5-jiangtianfeng@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 01:26:23 +0000 X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: nywnsi5xs67najmnnam7i959anqa6rou X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspamd-Queue-Id: 6798640008 X-HE-Tag: 1796520386-999551 X-HE-Meta: U2FsdGVkX1/CT/VDttHtDJF+VR2GFD3AvLj9fjqneEKIa0Wx+E8Y8XvNdWIRPajTxh5ewc0v/O9WWfFAL5cXUhOVRgTgUqp+nF7qCgtx53qByr9uwKCTgzC4fD2pyYI3u5TvtV77SEK3uNk7fSY9e/wiTgOnC5VUP26c6w/ux+VQ7Nvx6ZoRe1Mbx3HfzZvSjjPMnSXQoq+oFTeATbgpF3jJkw6yACyPoXuedQMXBFXG0dM1Iw8co91IayBcEMI89ags3du+anhw7vO9+vIG/6v2VQUSrv04vVwA6YR3U5LOv+ialboh8N7KVPIeowi48Pkal/hAJYQSNNUL1L3M+gYWeOdNyzEi9IHVXdIRESFIaA19TxatljHN4jRuXNpjBb6pyUK7qSOXDw462HfrjXhqDwhwISDalnIdvKwkdHo3i4R2lESTOwfGxR1iI8sl7z+8JP/r0oc9ThMlo0DJY+iQpr527WiD2WXzjqofT75YGqLunh1uR5QVhrG/PGs1fv6f+3ezmGJTasgkYVTRfft6sGWLYqF0IZjnd/OBA2KFNv4wbDiq99S+S+t5phWNZC1m/+LiOZRIVrkaa9dSVFTKOpB/vh9a5iSmfXCTlvmZAKgKax7fyBsCfdIC4eKBmQTIqxAbBCWR3KkF8iXJv/XheqTuVAFKkUjI/c6twdxTbGUNiSYmFa0w/2aDFkJGdl0WlNkKI8w8Qn7Gbk3TbI/aSJWoATly54y1TVX3lczQbOSazcUmZ8Ehdq3DePY33SoXsUs+nlbfBqg3JrIk6tnLyCammoYhDB+1SHY37JoNhWrtzCa0w96IQ5scwTpRFVzKH3WT2TOCG0T+9wL0+YFrhPkkHBFw2c52qY9dVK46urDHA3HmlQl2y1UFdRrUB8uzda8S+JhcDOGYC3l2XgKH4koop5yQQL26Bn6K9dFPiGjRrKjbzJ7U6RmCk7EavgTTRd1FVIvtZ1H8NkO uMYH/2mr 2BTPXs4zephM1eizfNT7nPQOGUA+0HRdRgZFcsXBK2DpM7iViFu8dDVRQCZ5WM+/IwC8l6wt77hnjCBaaL29WSFG9EeJTg0Mdbkh7YNvsJj9ZmyRXBHQEQJkNzfvmWho7vrnbOT7ZTRIIOzlTV/tmrj5EKNCB2AmRqRvi2mPprXOBjoH/RJqV+8DuoTAUpfcgA/+B/Q8sGy0UB1Bbye7Xxl2kvU+kkiE494UPq5JMhEmZfGc95biZhF+PemzYtpfi8SpvDB46+npXcqSUhPK/APDt4QY51RASYo5l+3M9oiHbsOMaISRE33E/aUnbwBvbHEtAh0wbSCGYpyaFSh4nEMMxziCNEFC60rped+FjOReRuZLCC1DlVSrIEvo7+vQv6RpLwRVLha1dW9HadPJOkbEfSkbzaKjuvlUYwbTAxR3gYkpp0Y+qOB3m3IEwV7BLSXyAtAzqvNEgF1M7garZNbe5mtiZI77i+4jYf7pNNqkhvUxo69K8Hq/KI60mv84Wa7rV3itlI0cXFFdtyRemaZER8CqexANbWH73ZiYpOGEUyBnRzIFa9c7hGXEk5RuOapHfHf9neV8RqiZjSTg16cTu4JxARfWt9SkVq9zO3DlkMCsfP4V52Ydn9tDoFECIe7ePID4MZkDMM3dw2jT2FU1ZinLFYk+OZo8FwX53WyoMnCYMWcb7AILSp9HM0za/VRGIXYdX+LjJssQSaDKHs0QEGagsEHXjs62yNJL6Lij6H1g2R2Sl/NlHq5zppBV+/RP9iLSyqSrkv9xOb4GCBTDg+h/Bulkj3upfsq+YA44pdgyMoEI08YwtjLJAa0kqzxrhRujQZPO4DNneKFPqm2vcGr9icEBXG2I8TOpC8QKdGtSRcdsEu42fUD/BgpvV7Ssdf+PXqaImDoqSLhFYfHnbjkA3uLGWLIeN Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 11 potential issues to consider: - [High] arm64: EX_TYPE_ACCESS_ERR_ZERO SEA fixup livelocks futex retry loops - [Medium] arm64: SEA fixup in __arch_copy_to_user() livelocks read_kcore_iter() - [Medium] arm64: unconditional apei_claim_sea() in EL1 deadlocks on nested SEA - [Medium] arm64: fixup_exception_me() recovers kernel/user writes via ACCESS_ERR_ZERO - [Medium] arm64: broad SEA extable fixup turns EL0 emulation SEAs into SIGSEGV - [Medium] arm64: do_apei_claim_sea() recovers SEAs even without page isolation - [Low] arm64: unconfirmed ESR_ELx.WnR validity on FSC_EXTABT SEAs in extable - [Low] arm64: commit message contradicts GHES_CTX_KERNEL SIGBUS and extable scope - [Low] arm64: confirm ESR_ELx.SET =3D=3D 0b00 encoding in do_apei_claim_sea() - [Low] arm64: skipping 9997 fallback for MOPS faults may break usercopy progress - [Low] arm64: do_apei_claim_sea() skips ARM64_HAS_RAS_EXTN check for RES0 SET -- commit 50af6acf54c318c2deb67defca532465dfc1e14e Author: Ruidong Tian arm64: enable recover from synchronous external abort in kernel context This commit adds kernel-context recovery for EL1 synchronous external aborts in do_sea() via a new EX_TYPE_KACCESS_SEA exception table type and fixup_exception_me(), and annotates __arch_copy_to_user() kernel loads for SEA recovery while bypassing the single-byte fallback on MOPS usercopy faults. > Take copy_from/to_user for example, If ld* triggers a memory error, even = in > kernel mode, only the associated process is affected. Killing the user > process and isolating the corrupt page is a better choice. [Severity: Low] Does the commit message accurately reflect the SIGBUS and extable behavior? With commit "ACPI: APEI: GHES: use exception context to gate SIGBUS on pois= on consumption", GHES_CTX_KERNEL suppresses MF_ACTION_REQUIRED and force_sig(SIGBUS), so the user process is not killed and instead receives an error return such as -EFAULT. The commit message also describes kernel SEA recovery as limited to EX_TYPE_KACCESS_SEA and EX_TYPE_UACCESS_CPY source reads, omitting that fixup_exception_me() unconditionally recovers all EX_TYPE_ACCESS_ERR_ZERO entries. > diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_u= ser.S > index 400057d607ecd..04f152ff5b033 100644 > --- a/arch/arm64/lib/copy_from_user.S > +++ b/arch/arm64/lib/copy_from_user.S > @@ -54,7 +54,7 @@ > =20 > .macro cpy1 dst, src, count > .arch_extension mops > - USER_CPY(9997f, 0, cpyfprt [\dst]!, [\src]!, \count!) > + USER_CPY(9998f, 0, cpyfprt [\dst]!, [\src]!, \count!) > USER_CPY(9996f, 0, cpyfmrt [\dst]!, [\src]!, \count!) > USER_CPY(9996f, 0, cpyfert [\dst]!, [\src]!, \count!) > .endm > @@ -69,9 +69,11 @@ SYM_FUNC_START(__arch_copy_from_user) > ret > =20 > // Exception fixups > -9996: b.cs 9997f > + // MOPS faults skip the zero-progress retry to avoid repeating an SEA. > +9996: b.cs 9998f > // Registers are in Option A format > add dst, dst, count > + b 9998f [Severity: Low] This question rests on an arm64 architecture detail that the review could n= ot confirm from the kernel source: can FEAT_MOPS unprivileged copy instructions (cpyfprt/cpyfmrt/cpyfert and cpyfpwt/cpyfmwt/cpyfewt) take a synchronous da= ta abort with zero reported forward progress (leaving dst =3D=3D dstin after O= ption A/B register fixup) when a single-byte ldtrb/sttrb at byte 0 would succeed, such as on an MTE tag mismatch in a later granule or unaligned Device memor= y? If the answer is yes, bypassing label 9997 for all MOPS faults (here and in arch/arm64/lib/copy_to_user.S) breaks the forward-progress contract that 295cf156231c ("arm64: Avoid premature usercopy failure") added 9997 to uphold. In generic_perform_write() and iomap_write_iter(), fault_in_readable() only probes byte 0 of each page, so it would succeed and spin the write loop until a fatal signal arrives; copy_to_user() callers su= ch as filemap_read() would return -EFAULT instead of a short read. Bypassing 9997 only on SEA fixups would avoid repeating an SEA without changing ordinary usercopy faults. > diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S > index 819f2e3fc7a93..451bfeb0143b4 100644 > --- a/arch/arm64/lib/copy_to_user.S > +++ b/arch/arm64/lib/copy_to_user.S > @@ -20,7 +20,7 @@ > * x0 - bytes not copied > */ > .macro ldrb1 reg, ptr, val > - ldrb \reg, [\ptr], \val > + KERNEL_SEA(9998f, ldrb \reg, [\ptr], \val) > .endm [Severity: Medium] Does annotating regular __arch_copy_to_user() kernel loads with KERNEL_SEA (and allowing kernel-source reads in ex_handler_uaccess_cpy()) livelock callers that treat a short copy as an unmapped user page? In read_kcore_iter() for KCORE_VMALLOC, a while (true) loop with no signal check calls vread_iter() -> aligned_vread_iter() -> copy_page_to_iter_nofault() -> __arch_copy_to_user(). When the kernel load hits a poisoned vmalloc page, __arch_copy_to_user() returns a full residual (0 bytes copied), fault_in_iov_iter_writeable() succeeds because the user buffer is writable, and the loop spins forever re-triggering SEAs (commit "ACPI: APEI: GHES: use exception context to gate SIGBUS on poison consumption" skips duplicate-SEA -ECANCELED cancellation for GHES_CTX_KERNEL). This also causes filemap_read() to report a poisoned page-cache page as -EFAULT instead of -EIO, and btrfs copy_to_sk() to retry on poisoned extent buffers. Restricting kernel-source SEA recovery to an opt-in copy_mc_to_user() path, as x86 and powerpc do, would avoid conflating kernel memory errors with user page faults. > diff --git a/arch/arm64/mm/extable.c b/arch/arm64/mm/extable.c > index 402c5db692ffe..5ea013a3247c3 100644 > --- a/arch/arm64/mm/extable.c > +++ b/arch/arm64/mm/extable.c [ ... ] > @@ -55,10 +58,14 @@ static bool ex_handler_access_err_zero(const struct e= xception_table_entry *ex, > } > =20 > static bool ex_handler_uaccess_cpy(const struct exception_table_entry *e= x, > - struct pt_regs *regs, unsigned long esr) > + struct pt_regs *regs, unsigned long esr, > + bool allow_kernel_source) > { > - /* Do not fix up faults on kernel memory accesses */ > - if (!cpy_faulted_on_uaccess(ex, esr)) > + /* Only SEA may also accept copy_to_user's kernel source read. */ > + if (!cpy_faulted_on_uaccess(ex, esr) && > + !(allow_kernel_source && > + FIELD_GET(EX_DATA_UACCESS_WRITE, ex->data) && > + !(esr & ESR_ELx_WNR))) > return false; [Severity: Low] This question rests on an arm64 architecture detail that the review could n= ot confirm from the kernel source: for an EL1 synchronous external abort with DFSC =3D=3D ESR_ELx_FSC_EXTABT (especially on a FEAT_MOPS CPY* instruction = or when ESR_ELx_FnV is set), can a write-triggered SEA report ESR_ELx.WnR =3D= =3D 0 or UNKNOWN? If the answer is yes, cpy_faulted_on_uaccess() would treat a kernel-destination write SEA in __arch_copy_from_user() (where EX_DATA_UACCESS_WRITE is 0) as a user read and recover it, and the ESR_ELx_WNR check on EX_TYPE_KACCESS_SEA in fixup_exception_me() would likewise fail to reject a write SEA. [ ... ] > +bool fixup_exception_me(struct pt_regs *regs, unsigned long esr) > +{ > + const struct exception_table_entry *ex; > + > + ex =3D search_exception_tables(instruction_pointer(regs)); > + if (!ex) > + return false; > + > + switch (ex->type) { > + case EX_TYPE_ACCESS_ERR_ZERO: > + return ex_handler_access_err_zero(ex, regs); [Severity: High] Can unconditionally recovering EX_TYPE_ACCESS_ERR_ZERO entries here livelock futex retry loops on a poisoned user page? All arm64 futex atomics in arch/arm64/include/asm/futex.h emit EX_TYPE_ACCESS_ERR_ZERO. When one hits an SEA in EL1, GHES_CTX_KERNEL queu= es memory_failure_queue() asynchronously on the current CPU via schedule_work_on(smp_processor_id(), &mf_cpu->work) and suppresses force_sig(SIGBUS), while fixup_exception_me() returns -EFAULT. In futex_lock_pi() and handle_futex_death(), -EFAULT calls fault_in_user_writeable(), which sees the PTE still mapped and returns 0, a= nd immediately retries with no cond_resched() or fatal_signal_pending() check. Under CONFIG_PREEMPT_NONE this starves the queued memory_failure work on the same CPU; under any preemption model, if memory_failure is disabled or cann= ot unmap the page, futex_lock_pi(), handle_futex_death(), futex_wake_op(), and futex_requeue() loop indefinitely because GHES_CTX_KERNEL skips duplicate-SEA -ECANCELED cancellation. [Severity: Medium] Does handling EX_TYPE_ACCESS_ERR_ZERO unconditionally also recover kernel writes, user writes, and cache maintenance instructions? After commit "arm64: extable: merge UACCESS_ERR_ZERO and KACCESS_ERR_ZERO into ACCESS_ERR_ZERO", EX_TYPE_ACCESS_ERR_ZERO covers __put_kernel_nofault(= ), user stores and atomics (such as put_user(), clear_user(), and sttr* in copy_to_user()), and cache maintenance operations in caches_clean_inval_user_pou(). Because fixup_exception_me() checks neither ESR_ELx_WNR nor ESR_ELx_CM and cannot distinguish kernel from user entries, it silently turns SEAs on kernel destination writes and cache maintenance into -EFAULT. [Severity: Medium] Does this EX_TYPE_ACCESS_ERR_ZERO fixup also turn SEAs during trapped EL0 emulation into SIGSEGV instead of SIGBUS? Both user_cache_maint_handler() and compat swp_handler() annotate their user accesses with _ASM_EXTABLE_UACCESS_ERR and call arm64_notify_segfault() when the access returns -EFAULT. Because do_apei_claim_sea() does not exclude ESR_ELx_CM and GHES_CTX_KERNEL suppresses SIGBUS, an SEA on either path is reported to userspace as SIGSEGV. > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index b22736853fcd8..d8ff65c86728d 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -874,21 +874,43 @@ static int do_bad(unsigned long far, unsigned long = esr, struct pt_regs *regs) > return 1; /* "fault" */ > } > =20 > +/* > + * APEI claimed this as a firmware-first notification. > + * Some processing deferred to task_work before ret_to_user(). > + */ > +static int do_apei_claim_sea(struct pt_regs *regs, unsigned long esr) > +{ > + int ret; > + > + ret =3D apei_claim_sea(regs); > + if (ret) > + return ret; > + > + if (user_mode(regs)) > + return 0; [Severity: Medium] Can calling apei_claim_sea() unconditionally on every EL1 SEA self-deadlock on ghes_notify_lock_sea if a nested EL1 SEA occurs? DAIF_ERRCTX cannot mask synchronous external aborts, and unlike ghes_notify_nmi(), ghes_notify_sea() has no re-entrancy guard: do_sea() do_apei_claim_sea() apei_claim_sea() local_daif_restore(DAIF_ERRCTX) nmi_enter() ghes_notify_sea() raw_spin_lock(&ghes_notify_lock_sea) ghes_in_nmi_spool_from_list() do_sea() do_apei_claim_sea() apei_claim_sea() ghes_notify_sea() raw_spin_lock(&ghes_notify_lock_sea) <-- spins forever If a nested EL1 SEA hits before ghes_clear_estatus() clears block_status, this CPU deadlocks on ghes_notify_lock_sea (blocking any other CPU that lat= er takes an SEA). If the read inside ghes_has_active_errors() itself triggers an SEA, it recurses until stack overflow. [Severity: Medium] Can do_apei_claim_sea() recover a kernel SEA even when GHES did not isolate the failing page or process a memory error? ghes_in_nmi_queue_one_entry() returns 0 for any active non-panic SEA status block regardless of whether ghes_do_proc() queues memory_failure() (for example, a CPER record without CPER_MEM_VALID_PA, a non-memory section, or a kernel with CONFIG_ACPI_APEI_MEMORY_FAILURE=3Dn). Since commit "ACPI: APEI: GHES: use exception context to gate SIGBUS on poison consumption" also disabled the unqueued SIGBUS fallback for GHES_CTX_KERNEL, matching fixup_exception_me() silently converts an unisolated hardware error into -EFAULT without queuing memory_failure(), delivering SIGBUS, or setting TAINT_MACHINE_CHECK. > + /* A GHES claim alone does not make a kernel exception safe to skip. */ > + if (!is_el1_data_abort(esr) || > + (esr & ESR_ELx_FSC) !=3D ESR_ELx_FSC_EXTABT || > + (esr & ESR_ELx_S1PTW) || > + (esr & ESR_ELx_SET_MASK)) > + return -ENOENT; [Severity: Low] This question rests on an arm64 architecture detail that the review could n= ot confirm from the kernel source: on FEAT_RAS systems (including RASv1p1 and RASv2), can ESR_ELx.SET =3D=3D 0b00 for an EL1 data abort with DFSC =3D=3D ESR_ELx_FSC_EXTABT ever encode an uncontainable or non-UER error state rath= er than UER? arch/arm64/include/asm/esr.h only defines ESR_ELx_SET_SHIFT and ESR_ELx_SET_MASK without named ESR_ELx_SET_* encodings. If 0b00 can encode= a non-UER error, checking (esr & ESR_ELx_SET_MASK) =3D=3D 0 would skip a kern= el instruction on an uncontainable SEA instead of panicking (and reject valid UER aborts if UER uses a non-zero encoding). [Severity: Low] This question rests on an arm64 architecture detail that the review could n= ot confirm from the kernel source: on a CPU without FEAT_RAS (where ARM64_HAS_RAS_EXTN is absent and ESR_ELx.SET is RES0, as noted in kvm_handle_guest_sea()), can hardware deliver an EL1 synchronous external data abort with ESR_ELx_FSC_EXTABT and S1PTW =3D=3D 0 for an uncontainable = or unrecoverable error? If the answer is yes, because do_apei_claim_sea() does not check ARM64_HAS_RAS_EXTN, (esr & ESR_ELx_SET_MASK) always evaluates to 0 on non-R= AS CPUs, and apei_claim_sea() returns 0 for any non-panic GHES record, so fixup_exception_me() would skip the faulting kernel instruction and continue running after an uncontained hardware error instead of calling arm64_notify_die(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205012435.1406= 255-1-jiangtianfeng@linux.alibaba.com?part=3D4