From: Lvqiang <Lvqiang.Huang@unisoc.com>
To: <linux@armlinux.org.uk>, <ebiederm@xmission.com>,
<dave.hansen@linux.intel.com>, <anshuman.khandual@arm.com>,
<akpm@linux-foundation.org>, <Lvqiang.Huang@unisoc.com>,
<f.fainelli@gmail.com>, <will@kernel.org>, <tglx@linutronix.de>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] ARM: check __ex_table in do_bad()
Date: Thu, 7 Nov 2019 15:45:13 +0800 [thread overview]
Message-ID: <1573112713-10115-1-git-send-email-Lvqiang.Huang@unisoc.com> (raw)
We got many crashs in for_each_frame+0x18 arch/arm/lib/backtrace.S
1003: ldr r2, [sv_pc, #-4]
The backtrace is
dump_backtrace
show_stack
sched_show_task
show_state_filter
sysrq_handle_showstate_blocked
__handle_sysrq
write_sysrq_trigger
proc_reg_write
__vfs_write
vfs_write
sys_write
Related Kernel config
CONFIG_CPU_SW_DOMAIN_PAN=y
# CONFIG_ARM_UNWIND is not set
CONFIG_FRAME_POINTER=y
The task A was dumping the stack of an UN task B. However, the task B
scheduled to run on another CPU, which cause it stack content changed.
Then, task A may hit a page domain fault and die().
[520.661314] Unhandled fault: page domain fault (0x01b) at 0x32848c02
The addr 0x32848c02 is a valid user-space address.
PAGE DIRECTORY: d1854000
PGD: d1854ca0 => bb21e835
PMD: d1854ca0 => bb21e835
PTE: bb21e120 => afffa79f
With CONFIG_CPU_SW_DOMAIN_PAN=y, a page domain fault occurred.
{ do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault"},
Without check the __ex_table entry, do_bad() just return fault and die().
.pushsection __ex_table,"a"
.long 1003b, 1006b
This patch try __ex_table in do_bad(), the same as in __do_kernel_fault().
Signed-off-by: Lvqiang <Lvqiang.Huang@unisoc.com>
---
arch/arm/mm/fault.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index bd0f482..22f45df 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -487,11 +487,14 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
#endif /* CONFIG_ARM_LPAE */
/*
- * This abort handler always returns "fault".
+ * Checks __ex_table before returns "fault".
*/
static int
do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
{
+ if (fixup_exception(regs))
+ return 0;
+
return 1;
}
--
1.7.9.5
next reply other threads:[~2019-11-07 8:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-07 7:45 Lvqiang [this message]
2019-11-07 9:24 ` [PATCH] ARM: check __ex_table in do_bad() Russell King - ARM Linux admin
2019-11-07 15:30 ` 黄吕强 (Lvqiang Huang)
2019-11-07 17:22 ` 黄吕强 (Lvqiang Huang)
2019-11-08 2:16 ` 黄吕强 (Lvqiang Huang)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1573112713-10115-1-git-send-email-Lvqiang.Huang@unisoc.com \
--to=lvqiang.huang@unisoc.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=ebiederm@xmission.com \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).