From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8694CC83F1A for ; Mon, 14 Jul 2025 11:42:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FC5C6B008C; Mon, 14 Jul 2025 07:42:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ABB36B0092; Mon, 14 Jul 2025 07:42:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F030D6B0093; Mon, 14 Jul 2025 07:42:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E2A796B008C for ; Mon, 14 Jul 2025 07:42:36 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8014555D16 for ; Mon, 14 Jul 2025 11:42:36 +0000 (UTC) X-FDA: 83662682712.24.BE2B9C2 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by imf27.hostedemail.com (Postfix) with ESMTP id 833824000B for ; Mon, 14 Jul 2025 11:42:34 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=uX+hOJt+; spf=pass (imf27.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752493355; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h+76yUy7TzXhpXgqUwvq+FQ+43/zxDFHrfDPZv8tHy0=; b=Wx8sV99YndRMt+p/ny56WYE+2IAj7rhv929vVtZUTxLjo4sxrFo4zhyo61Am15NSL1UOYf 3SoCbcEfpetQ8NbKA5Vqpn61jaLKBtLaSrS1SB9/kFiiDyZwQWEk8+oH8QfcZfYb3n8zsK lziITTBEk/4U2CEzkIhGGilruEmjWMU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752493355; a=rsa-sha256; cv=none; b=T4sdn+h8Ko3Aui3oFuxlJrSjwjbAMS3MxSzpdMo5DXqgnF+ud1DmAaq0Ofp1hrs7AC8Zb7 mX2QxhJ6zuVWcHGxtjw8iATVYOHyL282h40tBy9gaIt4AmWtoSx7AUDMXYU+oSnEI65UM3 C1dwuzT6eW4FJkA/v03ixXTcrmMuEyo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=uX+hOJt+; spf=pass (imf27.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1752493351; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=h+76yUy7TzXhpXgqUwvq+FQ+43/zxDFHrfDPZv8tHy0=; b=uX+hOJt+N5bZsTrbRHIasy9P3hOtaAi0jhUtKJqTu9UHHKgAI96Axal+Py3E4lCdQlBRYZtZbr5/T+JAatvJgEICYn9xj82NNCQ5qI9LMkxVQBsmCX3jgysb4xrjdc4qS9YMGXBm2FSEVsKZqeW1QLcpPHJhTGHLxg4FnliJus8= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WiufzwS_1752493348 cluster:ay36) by smtp.aliyun-inc.com; Mon, 14 Jul 2025 19:42:29 +0800 From: Shuai Xue To: catalin.marinas@arm.com, sudeep.holla@arm.com, guohanjun@huawei.com, lpieralisi@kernel.org, linux-acpi@vger.kernel.org, yazen.ghannam@amd.com, mark.rutland@arm.com, mingo@redhat.com, robin.murphy@arm.com, Jonathan.Cameron@Huawei.com, bp@alien8.de, rafael@kernel.org, linux-arm-kernel@lists.infradead.org, wangkefeng.wang@huawei.com, tanxiaofei@huawei.com, mawupeng1@huawei.com, tony.luck@intel.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, james.morse@arm.com, tongtiangen@huawei.com, gregkh@linuxfoundation.org, will@kernel.org, jarkko@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-edac@vger.kernel.org, x86@kernel.org, xueshuai@linux.alibaba.com, justin.he@arm.com, ardb@kernel.org, ying.huang@linux.alibaba.com, ashish.kalra@amd.com, baolin.wang@linux.alibaba.com, tglx@linutronix.de, dave.hansen@linux.intel.com, lenb@kernel.org, hpa@zytor.com, robert.moore@intel.com, lvying6@huawei.com, xiexiuqi@huawei.com, zhuo.song@linux.alibaba.com Subject: [PATCH v19 1/2] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 14 Jul 2025 19:42:11 +0800 Message-Id: <20250714114212.31660-2-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250714114212.31660-1-xueshuai@linux.alibaba.com> References: <20250714114212.31660-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 833824000B X-Rspam-User: X-Rspamd-Server: rspam09 X-Stat-Signature: 6n6z51owy7fnsg7bkusu73cxyx4nz6fu X-HE-Tag: 1752493354-761433 X-HE-Meta: U2FsdGVkX1/Xsy0giI4yuxF9Xw8XovaXv6q33sfyJqL6WYKXA3VOh5Lm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NiP7JJVQvtzJiTbLLqRHilXRAvPLEKiEPycTLg0ZE3vTK8gGTnn+z2rwGCLw9IvCG0P2gL7SyXpQ5lziDqCGUSmlH0j9GXzugrwEAMNpHjLBxmLSmKRIAyqRCw1atduzJMrpHLi3mR+DAL+fG8J1qDoKNDRwqqcpX1vZ0h3JsFOWoahJP+YTb5ZGd0LbmtQFGwY/DbpyqAY9JhdmhIcXKx7HUAa X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Synchronous error was detected as a result of user-space process accessing a 2-bit uncorrected error. The CPU will take a synchronous error exception such as Synchronous External Abort (SEA) on Arm64. The kernel will queue a memory_failure() work which poisons the related page, unmaps the page, and then sends a SIGBUS to the process, so that a system wide panic can be avoided. However, no memory_failure() work will be queued when abnormal synchronous errors occur. These errors can include situations such as invalid PA, unexpected severity, no memory failure config support, invalid GUID section, etc. In such case, the user-space process will trigger SEA again. This loop can potentially exceed the platform firmware threshold or even trigger a kernel hard lockup, leading to a system reboot. Fix it by performing a force kill if no memory_failure() work is queued for synchronous errors. Signed-off-by: Shuai Xue Reviewed-by: Jarkko Sakkinen Reviewed-by: Jonathan Cameron Reviewed-by: Yazen Ghannam Reviewed-by: Jane Chu Reviewed-by: Hanjun Guo --- drivers/acpi/apei/ghes.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index f0584ccad451..281a0a2f6730 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -902,6 +902,17 @@ static bool ghes_do_proc(struct ghes *ghes, } } + /* + * If no memory failure work is queued for abnormal synchronous + * errors, do a force kill. + */ + if (sync && !queued) { + dev_err(ghes->dev, + HW_ERR GHES_PFX "%s:%d: synchronous unrecoverable error (SIGBUS)\n", + current->comm, task_pid_nr(current)); + force_sig(SIGBUS); + } + return queued; } -- 2.39.3