[Skiboot] [PATCH] asm/head: Fix comparison in opal_entry for switching to emergency

Stewart Smith stewart at linux.ibm.com
Mon Apr 30 17:37:48 AEST 2018


Vaibhav Jain <vaibhav at linux.vnet.ibm.com> writes:
> Commit 3fdd2629516d ("core/opal: Emergency stack for re-entry")
> introduced an emergency stack for re-entrant OPAL calls. A branch was
> added in opal_entry() that switches to emergency stack checks if
> current thread is already in an active opal call. However the
> conditional branch that checks the value cpu_thread->in_opal_call is
> reverse forcing the use of emergency stack in even in non re-entrant
> cases.
>
> This causes a opal stack guard routine __mcount_stack_check() to
> falsely assume that stack is overflown as stack pointer of
> EMERGENCY_STACK is compared against the bounds of NORMAL_STACK,
> forcing the function to call abort() with an error message of this
> form:
>
>  INIT: Starting kernel at 0x20010000, fdt at 0x3073f708 53664 bytes)
>  CPU 0004 Stack overflow detected ! pc=3001d8ec sp=31c27c90 (gap=30488) token=70
>  Aborting!
>  CPU 0004 Backtrace:
>  S: 0000000031c27b20 R: 000000003001ca2c E ._abort+0x60
>  S: 0000000031c27bb0 R: 0000000030013e10 E .__mcount_stack_check+0x168
>  S: 0000000031c27c90 R: 000000003001d8ec E .opal_entry_check+0x1c
>  S: 0000000031c27d20 R: 00000000300051a4 E opal_entry+0xf4
>  --- OPAL call token: 0x46 caller R1: 0xc0000000011e3e50 ---
>
> So this patch update the 'bne' branch in opal_entry() to 'bgt' branch
> so that switch to emergency stack only happens when current
> cpu_thread->is_opal_call is greater than 1 indicating an re-entrant
> opal call.
>
> Fixes: 3fdd2629516d ("core/opal: Emergency stack for re-entry")
> Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
> Signed-off-by: Mahesh J Salgaonkar <mahesh at linux.vnet.ibm.com>
> ---
>  asm/head.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Ahhh, the old not-testing-with-STACK_CHECK=1-bites-again trick. Doh.

Thanks for the patch, merged to master as of 8ed37072c07ee0c8be2ed8d9e2ede19333856e86

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list