[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207132204.1720444-6-tongtiangen@huawei.com>
Date: Wed, 7 Feb 2024 21:22:04 +0800
From: Tong Tiangen <tongtiangen@...wei.com>
To: Mark Rutland <mark.rutland@....com>, Catalin Marinas
<catalin.marinas@....com>, Will Deacon <will@...nel.org>, Andrew Morton
<akpm@...ux-foundation.org>, James Morse <james.morse@....com>, Robin Murphy
<robin.murphy@....com>, Andrey Konovalov <andreyknvl@...il.com>, Dmitry
Vyukov <dvyukov@...gle.com>, Vincenzo Frascino <vincenzo.frascino@....com>,
Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>, Alexander Potapenko
<glider@...gle.com>, Christophe Leroy <christophe.leroy@...roup.eu>, Aneesh
Kumar K.V <aneesh.kumar@...nel.org>, "Naveen N. Rao"
<naveen.n.rao@...ux.ibm.com>, Thomas Gleixner <tglx@...utronix.de>, Ingo
Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
<dave.hansen@...ux.intel.com>, <x86@...nel.org>, "H. Peter Anvin"
<hpa@...or.com>
CC: <linux-arm-kernel@...ts.infradead.org>, <linux-mm@...ck.org>,
<linuxppc-dev@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>, Tong Tiangen
<tongtiangen@...wei.com>, <wangkefeng.wang@...wei.com>, Guohanjun
<guohanjun@...wei.com>
Subject: [PATCH v11 5/5] arm64: send SIGBUS to user process for SEA exception
For SEA exception, kernel require take some action to recover from memory
error, such as isolate poison page adn kill failure thread, which are done
in memory_failure().
During the test, the failure thread cannot be killed due to this issue[1],
Here, I temporarily workaround this issue by sending signals to user
processes (!(PF_KTHREAD|PF_IO_WORKER|PF_WQ_WORKER|PF_USER_WORKER)) in
do_sea(). After [1] is merged, this patch can be rolled back or the SIGBUS
will be sent repeated.
[1]https://lore.kernel.org/lkml/20240204080144.7977-1-xueshuai@linux.alibaba.com/
Signed-off-by: Tong Tiangen <tongtiangen@...wei.com>
---
arch/arm64/mm/fault.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 78f9d5ce83bb..a27bb2de1a7c 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -824,9 +824,6 @@ static int do_sea(unsigned long far, unsigned long esr, struct pt_regs *regs)
const struct fault_info *inf;
unsigned long siaddr;
- if (do_apei_claim_sea(regs))
- return 0;
-
inf = esr_to_fault_info(esr);
if (esr & ESR_ELx_FnV) {
siaddr = 0;
@@ -838,6 +835,19 @@ static int do_sea(unsigned long far, unsigned long esr, struct pt_regs *regs)
*/
siaddr = untagged_addr(far);
}
+
+ if (do_apei_claim_sea(regs)) {
+ if (!(current->flags & (PF_KTHREAD |
+ PF_USER_WORKER |
+ PF_WQ_WORKER |
+ PF_IO_WORKER))) {
+ set_thread_esr(0, esr);
+ arm64_force_sig_fault(inf->sig, inf->code, siaddr,
+ "Uncorrected memory error on access to poison memory\n");
+ }
+ return 0;
+ }
+
arm64_notify_die(inf->name, regs, inf->sig, inf->code, siaddr, esr);
return 0;
--
2.25.1
Powered by blists - more mailing lists