Received: by 2002:a05:7412:b112:b0:f9:3106:f1c0 with SMTP id az18csp85113rdb; Sun, 17 Dec 2023 22:51:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+Ja1vYJh4dga0Vicc3RfBXmqSpgFXSHi9xmUuW2cWtHsj0NmApUYchQocbRPv3BcpKsIp X-Received: by 2002:aa7:8d4b:0:b0:6ce:3aca:c5f1 with SMTP id s11-20020aa78d4b000000b006ce3acac5f1mr16366026pfe.50.1702882278985; Sun, 17 Dec 2023 22:51:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702882278; cv=none; d=google.com; s=arc-20160816; b=nrMJbEhs5ZxjQOt7sD3zy48DGSjfKNDaOUbaA3aGwtL6GH41WQRGLc5QORoeyR7YyK eXHWagrC8nKmS1bDTrkpRS74Cu5ftCjs/liOsJhLCrBBJ8fhWr6BYmd7Nq2iwE+J10qo TOw9YLg0KpX/RXF5LECAKENWlcqQTSagA/IuoPUAxsl66cg7Wdeom2gIRpIrrwqcJIlN ayKZEs8+8JKWP2Q5072sZPvZ2xbpnjP9tQFhAmMbe7hx4KCSFPG9bYplxqM3kIvf5FCG tfclobPv2tZtQZ24lNVs6rH3Pi5pOjV8HMdXoMoSZ0E37dXtdV4GZs1Y0EE6nhLagOja i7Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=/sRQfPLo2YFRl3757JNepg4wTl7qVsEe6Vc13KNsBKw=; fh=2vSDPmybdbFLizjyi+m3UstEO9s2E4YiFiwbQZuWlSI=; b=Ky2WL0369e5Z8XFCUwmISNAR0IQpjPgyBInwIyZz2Y7mZvnvfeROtTtkvjoQp+QM/J r6si7JOkhyYXnRS5NdCsuxMIkcnmPwmlz5z0PPUlV5jMqD2Bz7rNbYtvPIle79eXuFMM OIdofjR2o53i0xfFl+70lKdoHchfa+MWyqY+IpD0syBEdxuzT6d93sOIcfuSTyiyqQdT 1ZVUhZ2ciqPUzR9uWYnbRfI31W+A3iqIvj/xf69Law7ZWXlZNLav1V1/D4KDfcOGYraE lGNHG85nfIKtbLj6vGlzRnFQk7yEvG3L71CXbd9FEWrw5tryNwAZ52eYL1eiMNJoW3m/ Ag0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q21-20020a056a00085500b006d8174b97efsi750480pfk.104.2023.12.17.22.51.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 22:51:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9FA932829DE for ; Mon, 18 Dec 2023 06:51:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB86D8481; Mon, 18 Dec 2023 06:50:58 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B3ED79C7; Mon, 18 Dec 2023 06:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R991e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=35;SR=0;TI=SMTPD_---0VygHb-B_1702881929; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VygHb-B_1702881929) by smtp.aliyun-inc.com; Mon, 18 Dec 2023 14:45:31 +0800 From: Shuai Xue To: 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, 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, acpica-devel@lists.linuxfoundation.org, stable@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, mingo@redhat.com, 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 v10 2/4] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 18 Dec 2023 14:45:19 +0800 Message-Id: <20231218064521.37324-3-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027042445.60108-1-xueshuai@linux.alibaba.com> References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- drivers/acpi/apei/ghes.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ab2a82cb1b0b..f832ffc5a88d 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -717,6 +717,15 @@ 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("Sending SIGBUS to current task due to memory error not recovered"); + force_sig(SIGBUS); + } + return queued; } -- 2.39.3