2022-04-18 08:55:30

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [PATCH] ARM: fix the incorrect value of sp in __die()

On Mon, Apr 18, 2022 at 03:45:16AM +0000, Yuanzheng Song wrote:
> The dump_mem() will output useless content that exceed the stack
> in __die(), because sp will exceed the top of stack when the
> CONFIG_VMAP_STACK=y.

However, regs->ARM_sp _is_ the value of the stack pointer of the parent
context when the exception was taken, and is the correct value to start
printing the stack from.

If the first few prints are unreadable, then that's useful information.

> Insufficient stack space to handle exception!
> Task stack: [0xf09dc000..0xf09de000]
> IRQ stack: [0xf0800000..0xf0802000]
> Overflow stack: [0xc210e000..0xc210f000]
> Internal error: kernel stack overflow: 0 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 81 Comm: sh Not tainted 5.18.0-rc3 #4
> Hardware name: ARM-Versatile Express
> PC is at mmioset+0x20/0xa8
> LR is at recursive_loop+0x34/0x9c
> pc : [<c0777080>] lr : [<c0a90c6c>] psr: 20000013
> sp : f09dbf48 ip : f09dbf4c fp : 00219644
> ...
> Stack: (0xf09dbf48 to 0xf09de000)
> bf40: ???????? ???????? ???????? ???????? ???????? ????????
> bf60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> bf80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> bfa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> bfc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> bfe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> c000: 57ac6e9d 00000000 00000000 00000000 00000000 00000000 00000000 00000000

The above is useful information - it tells us that 0xf09dbf48 to
0xf09dc000 fault when accessed.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!


2022-04-18 10:43:58

by Yuanzheng Song

[permalink] [raw]
Subject: Re: [PATCH] ARM: fix the incorrect value of sp in __die()

Thanks for your reply.

I didn't fully understand these code, please ignore this patch.

Thanks.

On 2022/4/18 16:03, Russell King (Oracle) wrote:
> Insufficient stack space to handle exception!
> Task stack: [0xf09dc000..0xf09de000]
> IRQ stack: [0xf0800000..0xf0802000]
> Overflow stack: [0xc210e000..0xc210f000]
> Internal error: kernel stack overflow: 0 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 81 Comm: sh Not tainted 5.18.0-rc3 #4
> Hardware name: ARM-Versatile Express
> PC is at mmioset+0x20/0xa8
> LR is at recursive_loop+0x34/0x9c
> pc : [<c0777080>] lr : [<c0a90c6c>] psr: 20000013
> sp : f09dbf48 ip : f09dbf4c fp : 00219644
> ...
> Stack: (0xf09dbf48 to 0xf09de000)