[Skiboot] [PATCH] core/cpu: Prevent clobbering of stack guard for boot-cpu

Stewart Smith stewart at linux.vnet.ibm.com
Thu Apr 5 12:39:03 AEST 2018

Vaibhav Jain <vaibhav at linux.vnet.ibm.com> writes:
> Commit 90d53934c2da ("core/cpu: discover stack region size before
> initialising memory regions") introduced memzero for struct cpu_thread
> in init_cpu_thread(). This has an unintended side effect of clobbering
> the stack-guard cannery of the boot_cpu stack. This results in opal
> failing to init with this failure message:
> CPU: P9 generation processor (max 4 threads/core)
> CPU: Boot CPU PIR is 0x0004 PVR is 0x004e1200
> Guard skip = 0
> Stack corruption detected !
> Aborting!
> CPU 0004 Backtrace:
>  S: 0000000031c13ab0 R: 0000000030013b0c   .backtrace+0x5c
>  S: 0000000031c13b50 R: 000000003001bd18   ._abort+0x60
>  S: 0000000031c13be0 R: 0000000030013bbc   .__stack_chk_fail+0x54
>  S: 0000000031c13c60 R: 00000000300c5b70   .memset+0x12c
>  S: 0000000031c13d00 R: 0000000030019aa8   .init_cpu_thread+0x40
>  S: 0000000031c13d90 R: 000000003001b520   .init_boot_cpu+0x188
>  S: 0000000031c13e30 R: 0000000030015050   .main_cpu_entry+0xd0
>  S: 0000000031c13f00 R: 0000000030002700   boot_entry+0x1c0
> So the patch provides a fix by tweaking the memset() call in
> init_cpu_thread() to skip over the stack-guard cannery.

Huh... interesting that this wasn't caught by any of the CI/testing I
tend to do.... although I guess we don't have anything running with
STACK_CHECK=1 by default.

I should probably fix that :)

Anyway, running through the merging routine now.

Stewart Smith
OPAL Architect, IBM.

More information about the Skiboot mailing list