Re: [PREEMPT] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted

From: Christian Zigotzky

Date: Sun Dec 06 2026 - 09:33:03 EST


On 06/12/26 11:53, Christophe Leroy (CS GROUP) wrote:
Hi Damien,

Le 06/12/2026 à 07:25, Damien Stewart a écrit :
On 25/11/26 3:28 pm, Christian Zigotzky wrote:

It is very difficult to figure out what the issue is because it occurs sporadically.

Cheers,
Christian


So after reading info I've found I'm sure it's due to the same issue that has plagued PPC64 before. I've examined ASM code and found the compiler is caching register r13 into r10 in the 7.3.0 kernel build which I found corrupted the canary. So it's reading off a stale PACA pointer, yes, that old canard again.

The cause looks to be no static TLS register on PPC64 so the volatile PACA is used instead. The problem being the compiler doesn't seem to be aware the PACA is volatile so any preemptive move switching a task can change it. In that case I wonder if the current PACA should contain an extra pointer that is always guaranteed to hold current task context for that CPU.


So GCC version 9.4.0 and GCC version 10.4.0 are known to cause it in compiled code. The bug is rather annoying as the source code looks fine but machine code generated by certain compilers producing unstable code. The GCC option "-mstack-protector-guard-reg=r13" should solve it. Which option CONFIG_STACKPROTECTOR should enable. But, only for later compilers. If an earlier compiler must be used, to circumvent any other build or code issues, then a clean patch to tell the compiler r13 is volatile looks like one solution.


Can you provide more details, like the disassembly of the function where you suspect the use of r10 being a problem ?

What do you mean by "Which option CONFIG_STACKPROTECTOR should enable" ?
STACKPROTECTOR cannot be selected if the compiler doesn't support -mstackprotector-guard-reg=r13,  see commit bf6cbd0c87f3 ("powerpc: Fix stackprotector detection for non-glibc toolchains") and commit 06ec27aea9fc ("powerpc/64: add stack protector support")

So with older compilers you just can't select CONFIG_STACKPROTECTOR because powerpc doesn't select CONFIG_HAVE_STACKPROTECTOR in that case.

Christophe

Hi all,

Should I compile the RC6 with GCC11?

CONFIG_STACKPROTECTOR was already enabled in RC5. Or should I try disabling CONFIG_STACKPROTECTOR_STRONG?

What should I do?

Thanks,
Christian

--
Sent with Warpzilla 35.0.3 (https://github.com/chzigotzky/Web-Browsers-and-Suites-for-Linux-PPC/releases/tag/Warpzilla_35.0.3)