From patchwork Mon Oct 14 08:42:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13834332 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 97BF1CFC500 for ; Mon, 14 Oct 2024 08:43:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3F466B008A; Mon, 14 Oct 2024 04:43:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA0276B008C; Mon, 14 Oct 2024 04:43:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C9456B0092; Mon, 14 Oct 2024 04:43:05 -0400 (EDT) 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 71A116B008A for ; Mon, 14 Oct 2024 04:43:05 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 50772A0C77 for ; Mon, 14 Oct 2024 08:42:51 +0000 (UTC) X-FDA: 82671567762.12.2940BE6 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf01.hostedemail.com (Postfix) with ESMTP id EDB8240011 for ; Mon, 14 Oct 2024 08:42:57 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=IddTTNJ1; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf01.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 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=1728895227; 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=VBzjQDC8ZxBlJwIBTfVT7ZuELvawCTFuUb7vm2yyQIs=; b=EqYeW2vX1tjpl3embSUMbNG36swxT+RzO0pWd9YakFatShSF7Ej0CEL51PIJ+GGSSdORWV jBXhbYoKG/bvDGc6v085lpiCnE4JOWn5BGljIxIfi4CvSycFITtoUCRRAqhBjVzICBRnjV 9069s2IR2HsGZ3CYHAi6YzVICcEfVJ4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728895227; a=rsa-sha256; cv=none; b=nTGDSiJ1RdNK0kbKoU/DSWW1V3FuXx2oSbF4RY6COdcz/l5erU7S4/Oy3+u5pXGu8od7KO RVaX7DMWh0tsFce+KxxPZ7Q7MY9gGpsdXRCetgjVDfQupA2AmZBOrohqxQ85i/sqjFwpK6 vnWDkxws/ndEgas8vpkOksAXAsiDp1o= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=IddTTNJ1; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf01.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1728895380; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=VBzjQDC8ZxBlJwIBTfVT7ZuELvawCTFuUb7vm2yyQIs=; b=IddTTNJ1BldzwuDtnN3MzYy0xMObQM/eb+21nHvVGYGbj2b7BasH+Gw6mCyeerVlkIctQlzA+xuNO5klgVagGvC8t7e9rGwoD/Pxkg0ylymvJxXlrqt70TS4y0bD7OkOCpcSj5SI+nMaq9g03B/cOYijYes5sWHNwZ/htkGxz0U= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WH3mwSg_1728895376 cluster:ay36) by smtp.aliyun-inc.com; Mon, 14 Oct 2024 16:42:58 +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 v14 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 14 Oct 2024 16:42:38 +0800 Message-ID: <20241014084240.18614-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EDB8240011 X-Stat-Signature: n56rtu3f5pjrdmuqskugrxumazn3k6qu X-Rspam-User: X-HE-Tag: 1728895377-194419 X-HE-Meta: U2FsdGVkX1/LDSrPUwxYFiYjKo4xTI+hYeMnJJ9rOoy0JHpu0YObxxJ6qk73SlR9SyYsL5GCraNNBA2b390RXbKJu8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apwkmjxCgJzgSZA3z9FZzDuAioQ0byXaRF6XROFRr2dJ/u7lzIi4RV/HNEgGSj8RQTg== 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 --- 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..f2ee28c44d7a 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; }