Subject: [Bug 216041] Stack overflow at boot (do_IRQ: stack overflow: 1984) on a PowerMac G4 DP, KASAN debug build

From: [email-masked]
Date: Sun, 29 May 2022 08:06:31 +0000

https://bugzilla.kernel.org/show_bug.cgi?id=216041

--- Comment #5 from Christophe Leroy ([email-masked]) ---
There is an interrupt, that needs too looked at a bit deeper:

[eaa1c7a0] [c07d0bd4] dump_stack_lvl+0x60/0x90
[eaa1c7c0] [c0009234] __do_IRQ+0x170/0x174
[eaa1c800] [c0009258] do_IRQ+0x20/0x34
[eaa1c820] [c00045b4] HardwareInterrupt_virt+0x108/0x10c

The interesting part is __do_IRQ() :

void __do_IRQ(struct pt_regs *regs)
{
        struct pt_regs *old_regs = set_irq_regs(regs);
        void *cursp, *irqsp, *sirqsp;

        /* Switch to the irq stack to handle this */
        cursp = (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
        irqsp = hardirq_ctx[raw_smp_processor_id()];
        sirqsp = softirq_ctx[raw_smp_processor_id()];

        check_stack_overflow();

        /* Already there ? */
        if (unlikely(cursp == irqsp || cursp == sirqsp)) {
                __do_irq(regs);
                set_irq_regs(old_regs);
                return;
        }
        /* Switch stack and call */
        call_do_irq(regs, irqsp);

        set_irq_regs(old_regs);
}

The dump_stack() we see in the call trace is from check_stack_overflow(),
following the message "do_IRQ: stack overflow: 1984", because the stack dropped
below 0xeaa1c800

check_stack_overflow() function emits a warning and a stack dump when
CONFIG_DEBUG_STACKOVERFLOW is selected and only 2kbytes remain available on the
stack.

But here we get an Oops when the stack reaches 0xeaa1c000. Seems like the
2kbytes limit it not enough to properly perform the stack dump.

Commit 547db12fd8a0 ("powerpc/32: Use vmapped stacks for interrupts") doesn't
remove IRQ stacks. It change the IRQ stacks allocation from kmalloc to vmalloc.

Here we are stillon the original stack. The switch to the IRQ stack is
performed by call_do_irq().

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.