[RFC PATCH] LoongArch: Fix intermittent nptl/tst-cancel32 failure

Xi Ruoyao xry111@xry111.site
Wed Aug 5 03:33:27 GMT 2026


On Wed, 2026-08-05 at 10:09 +0800, mengqinggang wrote:
>  
> Hi Wilco,
>  
> I'm sorry, I don't think I fully understood your point.
>  On LoongArch64:
>  PTR_DEMANGLE2 (sp, t0, t1) 
> expand to:
> 
> rotri.d         $sp, $t0, 0x11
> xor             $sp, $sp, $t1
>  
>  The SP register is partially updated between the rotri.d and xor
> instructions.
>  Using this value in the pthread_cancel path may cause a SIGSEGV. 
> I think this issue is not relate to t0 register.

Meaning we can simply expand it to

rotri.d $t0, $t0, 0x11
xor     $sp, $sp, $t1

instead of introducing t2.  (With a comment for PTR_DEMANGLE2 saying it
will clobber the input in t0.)

-- 
Xi Ruoyao <xry111@xry111.site>


More information about the Libc-alpha mailing list