[PATCH v2 4/9] ARM: unwind: support unwinding across multiple stacks

Arnd Bergmann arnd at arndb.de
Tue Oct 5 05:17:50 PDT 2021


On Tue, Oct 5, 2021 at 9:15 AM Ard Biesheuvel <ardb at kernel.org> wrote:
>
> Implement support in the unwinder for dealing with multiple stacks.
> This will be needed once we add support for IRQ stacks, or for the
> overflow stack used by the vmap'ed stacks code.
>
> This involves tracking the unwind opcodes that either update the virtual
> stack pointer from another virtual register, or perform an explicit
> subtract on the virtual stack pointer, and updating the low and high
> bounds that we use to sanitize the stack pointer accordingly.
>
> Signed-off-by: Ard Biesheuvel <ardb at kernel.org>

I can't say I understand the code in detail, but I see nothing wrong here
either.

Reviewed-by: Arnd Bergmann <arnd at arndb.de>

> -       else if ((insn & 0xf0) == 0xa0) {
> +               ctrl->sp_low = ctrl->vrs[SP];
> +               ctrl->sp_high = ALIGN(ctrl->sp_low, THREAD_SIZE);
> +       } else if ((insn & 0xf0) == 0xa0) {

Would this break if the IRQ stack is not aligned to THREAD_SIZE?
If it would, it may be good to document this somewhere, probably
in patch 7, not here.

        Arnd



More information about the linux-arm-kernel mailing list