Hello everyone.

On 26/11/26 4:32 pm, Christian Zigotzky wrote:
It occurs sporadically during workloads. Disabling tracing did not solve the issue.

Log: https://github.com/user-attachments/files/35445406/Nemo_kernel_preempt_with_stack_issue.log

Link to the bug report: https://github.com/chzigotzky/kernels/issues/22

I'm also gathering data on this and finding the bug to be very stubborn. I have a Debia/sid install which I booted with a 7.3.0 kernel build and it showed up immediately. Then a few boots later disappeared. I also have Debian based Mint install which I tested and produced the error from same kernel. From this I collected logs. However, the kernel is unwilling to give any stack trace and just stops dead with a function offset. I have a serial terminal attached I can collect logs from so it may need extra debug options enabled in config. Don't know why it gives barely any info since a panic is usually considered a major show stopper. Also stopping dead like that isn't helpful when it needs advanced debugging tools to extract the info live from dead kernel memory.

Linux version 7.3.0-powerpc64-smp (testuser@build02) (powerpc-linux-gnu-gcc (Debian 9.3.0-22) 9.3.0, GNU ld (GNU Binutils for Debian) 2.44) # SMP PREEMPT

I have found it can panic on boot, panic in use like editing inside a browser, or panic on shutdown.


In my case it has happened in: srcu_gp_start_if_needed+0x510/0x514

Some ASM near crash site:

c00000000014a508 <srcu_gp_start_if_needed>:
c00000000014a508:    3c 4c 02 0e     addis   r2,r12,526
c00000000014a50c:    38 42 95 f8     addi    r2,r2,-27144
c00000000014a510:    7c 08 02 a6     mflr    r0
c00000000014a514:    4b ef 78 f5     bl      c000000000041e08 <_mcount>

...

c00000000014a6e8:    e9 21 00 48     ld   r9,72(r1)
c00000000014a6ec:    e9 4a 08 70     ld      r10,2160(r10)
c00000000014a6f0:    7d 29 52 79     xor.    r9,r9,r10
c00000000014a6f4:    39 40 00 00     li      r10,0
c00000000014a6f8:    40 82 03 18     bne     c00000000014aa10 <srcu_gp_start_if_needed+0x508>

...

c00000000014aa04:    60 00 00 00     nop
c00000000014aa08:    40 92 ff 24     bne     cr4,c00000000014a92c <srcu_gp_start_if_needed+0x424> c00000000014aa0c:    4b ff ff 50     b       c00000000014a95c <srcu_gp_start_if_needed+0x454>
c00000000014aa10:    fa e1 00 58     std     r23,88(r1)
c00000000014aa14:    49 77 50 11     bl      c0000000018bfa24 <__stack_chk_fail+0x8>
c00000000014aa18:    60 00 00 00     nop
c00000000014aa1c <call_srcu>:


That 0x510 offset should correspond to C00000000014AA18 after __stack_chk_fail call. Which would be return address. I can see the routine at c00000000014a6f8 above is branching to c00000000014aa10 when the stack canary fails.


In the source tree from function here:

https://github.com/torvalds/linux/blob/v7.3/kernel/rcu/srcutree.c#L1284


Would also help if some small code could be written that causes the srcu_gp_start_if_needed function to always fail with a stress test.


Now, I also found this article on a stack crash from same function. So this looks like an old issue. Possibly due to compiler clobbering over r13 and the paca, which I recently found out what it was, due to compiler optimising away and effectively killing the canary.

https://www.joelfernandes.org/blog/2023-04-25/ppc-stack-guards.html



--
My regards,

Damien Stewart.


Reply via email to