hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8386 ------------------------------------------ On arm64, when a Synchronous External Abort (SEA) occurs in kernel context (e.g., during memory compaction via kcompactd), the error follows this path: do_sea() -> do_apei_claim_sea() -> apei_claim_sea() -> ghes_notify_sea() -> ghes_in_nmi_spool_from_list() -> irq_work_queue(&ghes_proc_irq_work) -> ghes_proc_in_irq() [IRQ context] -> ghes_do_proc() -> ghes_handle_arm_hw_error() When ghes_handle_arm_hw_error() returns false (error not recoverable), ghes_do_proc() sends SIGBUS to the current task via force_sig(SIGBUS). However, kernel threads (e.g., kcompactd) have current->mm == NULL. Sending SIGBUS to a kernel thread is meaningless and may cause unexpected behavior. The SIGBUS signal should only be delivered to user-space processes. Fix by adding a check for current->mm before sending the signal. This ensures that only tasks with a valid userspace memory mapping receive the SIGBUS signal when a hardware error cannot be recovered. Fixes: 9c72f69e011e ("arm64: add support for ARCH_HAS_COPY_MC") Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- drivers/acpi/apei/ghes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 51cd04307ee4..faf521a45dbd 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -818,7 +818,7 @@ static void ghes_do_proc(struct ghes *ghes, * If no memory failure work is queued for abnormal synchronous * errors, do a force kill. */ - if (sync && !queued) { + if (sync && !queued && current->mm) { pr_err("Sending SIGBUS to current task due to memory error not recovered"); force_sig(SIGBUS); } -- 2.43.0