From patchwork Fri Sep 20 04:30:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13808126 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 038C4CF58CB for ; Fri, 20 Sep 2024 04:30:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 645C46B0082; Fri, 20 Sep 2024 00:30:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F62F6B0083; Fri, 20 Sep 2024 00:30:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BD486B0085; Fri, 20 Sep 2024 00:30:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2E7AC6B0082 for ; Fri, 20 Sep 2024 00:30:50 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 43E61C122B for ; Fri, 20 Sep 2024 04:30:49 +0000 (UTC) X-FDA: 82583841018.23.6BACC78 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by imf02.hostedemail.com (Postfix) with ESMTP id 5F97E80003 for ; Fri, 20 Sep 2024 04:30:46 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=xjaQxxg8; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf02.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.110 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726806636; a=rsa-sha256; cv=none; b=zddAyLgMIWeNzX54TOKAW5beSYx4QYKoioOLG+D57t4CWkPkBrGuVplyMGPYgGPsyqmKHs rmBXXCtD7b1QABhb2IPkXxEgaNJOqOz1buwdoEuMqYDYiXIwTEjYbjiXLBeraBBb/qAsLw rdGKLV1g7VqlIXuOLz7bHUWOc9UalnY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=xjaQxxg8; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf02.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.110 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=1726806636; 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=dFoBE4+/zB3lnbneu+kgWUeKvl7Lb5hy3AUk2WpE210=; b=p4g4F2pW0I4EZLNUEX35+f6NanTJ3uWwaI0RvR6prXjYG836ewZIMRmN7OdfTlTQTnCVI1 ssPK2NJv8G8Ef5EqG51pmt1GO+0J5ZTflIzwyiZXSkcLU/JHPs1KfKmiWuKigIsVmMAolf I3XhiNxhF1iihh/HXoL8RBTt7cq9TZ4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1726806643; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=dFoBE4+/zB3lnbneu+kgWUeKvl7Lb5hy3AUk2WpE210=; b=xjaQxxg8chHXLjtRSX1d1+cN/OPKMUSIYXDswZWr8X4ZGMNlLxm/eMNVC0232v2oVVUu/ImIPo1eOe+/pM4QjdPirOli3fxPvK9yXNLnm5/mLkXUb+d3lWfMBEstQoWfQtGdkjw6ZkOqWzf5OtGL4KrJ0gdoGGgwb9udJ8bjsVk= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WFJd0Il_1726806640) by smtp.aliyun-inc.com; Fri, 20 Sep 2024 12:30:42 +0800 From: Shuai Xue To: 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 v13 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Fri, 20 Sep 2024 12:30:25 +0800 Message-ID: <20240920043027.21907-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-Stat-Signature: 4rd6jni5o65z7bmbnij1kxqup87mzczw X-Rspamd-Queue-Id: 5F97E80003 X-Rspamd-Server: rspam02 X-HE-Tag: 1726806646-422006 X-HE-Meta: U2FsdGVkX18JaXT3Hse0Z8+i50cyT3yytkaTxPixKqQb3e6yW5/m3pEphxl5eZ8cpMP7UQxarI/qVP2DHTl3ddG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+RKDN8617hG2d5HmJ8dhC9eXOrgrZh50Nk6DVufxQQTAhacVFWSHW4W2+u 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 --- 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 623cc0cb4a65..93eb11482832 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("%s:%d: hardware memory corruption (SIGBUS)\n", + current->comm, task_pid_nr(current)); + force_sig(SIGBUS); + } + return queued; }