Re: [PATCH] ARM: check __ex_table in do_bad()

From: Russell King - ARM Linux admin
Date: Thu Nov 07 2019 - 04:24:50 EST


On Thu, Nov 07, 2019 at 03:45:13PM +0800, Lvqiang wrote:
>
> 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

What is "an UN 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

So, the backtrace code is trying to access userspace. It isn't supposed
to be accessing userspace - there are no guarantees that userspace will
be using frame pointers. That is the bug.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up