From: Ma Wupeng mawupeng1@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB0OV7
--------------------------------
Commit 9fb439551cb4("arm64: send sig fault for user task when apei_claim_sea fails") try to restore regs->pc if apei_claim_sea failes. However this is needed for arm64_notify_die to dump the right stack before panic not for other scenarios and this may lead to memory errors be triggered repeatedly and cannot be handled correctly. Fix it.
Fixes: 9fb439551cb4 ("arm64: send sig fault for user task when apei_claim_sea fails") Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- arch/arm64/mm/fault.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 427b1152b008..b2996525b273 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -745,14 +745,19 @@ static bool arm64_do_kernel_sea(void __user *addr, unsigned int esr, return false;
err = apei_claim_sea(regs); - if (err) { - regs->pc = orig_pc; - pr_emerg("apei claim sea failed. addr: %#lx, esr: %#x\n", - (unsigned long)addr, esr); - } + if (err) + pr_emerg( + "comm: %s pid: %d apei claim sea failed. addr: %#lx, esr: %#x\n", + current->comm, current->pid, (unsigned long)addr, esr); + + if (!current->mm) { + if (err) { + regs->pc = orig_pc; + return false; + }
- if (!current->mm) - return err ? false : true; + return true; + }
set_thread_esr(0, esr); arm64_force_sig_fault(sig, code, addr,