From patchwork Mon Nov 4 01:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13860785 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 237FFD1119B for ; Mon, 4 Nov 2024 01:54:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D64BC6B008A; Sun, 3 Nov 2024 20:54:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C97E36B0088; Sun, 3 Nov 2024 20:54:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B43836B007B; Sun, 3 Nov 2024 20:54:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 985A36B007B for ; Sun, 3 Nov 2024 20:54:53 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 347F880228 for ; Mon, 4 Nov 2024 01:54:53 +0000 (UTC) X-FDA: 82746743100.23.7DDC00E Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by imf02.hostedemail.com (Postfix) with ESMTP id E1BDC8000B for ; Mon, 4 Nov 2024 01:53:50 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=gNWzt2IN; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf02.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.97 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730685233; a=rsa-sha256; cv=none; b=VikHPRW1TZYfnnCTanlNWXiP49fXb/a44qyZhX46FmZhd7VWRvOjwtOaKesyCdVrnvPD7P DRmbAVSZiCcJqcPYfQp7P1g9wZGCHOtN6F66uYqkOz8czZlLxGQtAJ13lEWdq6oJSEnMSS YPgZ6wMKMDydKf1hJoVL1JIjNqcRwoE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=gNWzt2IN; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf02.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.97 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730685232; 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=wEZyxypm8qqC/EtYiYgmtvlZDEtMlxOhdIXUE3TG25Q=; b=6hbPuK9w7YnJhzL58ULQ/uNeIDXPau0nsw84vc33v9OvJxlSGH40yKC++ydwC5Ufu56yoE A/q7d1AHVKbyW19zawav0FAhYoXV2WA0RBU8xgqglO3Q/cxiiKFywoiD++g/m4SZlXosTA k5LpaTAM993zK7P5I3ouaQsMPbYMXBw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1730685286; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=wEZyxypm8qqC/EtYiYgmtvlZDEtMlxOhdIXUE3TG25Q=; b=gNWzt2INmMsWvnanaGiwrdxnfvXGbyAGaG7rxBX642AMxE/kUI5vs2D526O7GkL+9aCN2niGUPTLaqy5KZbTYdMyDf02tmOudHMEzbi+2rDAmp4mYhDmjriLyJwqzseJLri3dVur8a7HPjxdTxNPpcdhH4Kk+W/6ha8p+2kalTc= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WIZg3ti_1730685283 cluster:ay36) by smtp.aliyun-inc.com; Mon, 04 Nov 2024 09:54:44 +0800 From: Shuai Xue To: yazen.ghannam@amd.com, mark.rutland@arm.com, catalin.marinas@arm.com, mingo@redhat.com, robin.murphy@arm.com, Jonathan.Cameron@Huawei.com, bp@alien8.de, rafael@kernel.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-acpi@vger.kernel.org, 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@intel.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 v16 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 4 Nov 2024 09:54:28 +0800 Message-ID: <20241104015430.98599-2-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20221027042445.60108-1-xueshuai@linux.alibaba.com> References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: E1BDC8000B X-Rspamd-Server: rspam11 X-Stat-Signature: wwf5r134wrid3wruzdycxz55sxjpn5cg X-HE-Tag: 1730685230-151248 X-HE-Meta: U2FsdGVkX1/aux5BpHLccE+u6NKZbiS9r2Hw8REtWS54U0jJs9cRzhLS9aXVpymVKk+68cNQeKzzoPTVZho99FWZy5nzRlB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UbS7Bp+F1UDCEKok1IX1+9BsjhuurEN1gZmHp1+XM+rAX9S3l+ikIoW+kIL7uga9FUNV9ERIsw0RWJMv40G5epKtt9aCjxbYv3v/5xQJ5zag== 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 --- drivers/acpi/apei/ghes.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ada93cfde9ba..af3339dd3817 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -801,6 +801,16 @@ 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) { + pr_err(HW_ERR GHES_PFX "%s:%d: hardware memory corruption (SIGBUS)\n", + current->comm, task_pid_nr(current)); + force_sig(SIGBUS); + } + return queued; }