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

mengqinggang mengqinggang@loongson.cn
Wed Aug 5 02:09:25 GMT 2026


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.


在 2026/8/4 21:50, Wilco Dijkstra 写道:
> Hi Mengqinggang,
>
>> 	REG_L t0, a0, 0*SZREG
>> -	PTR_DEMANGLE (ra, t0, t1)
>> +	PTR_DEMANGLE (ra, t0, t1, t2)
>> 	REG_L t0, a0, 1*SZREG
>> -	PTR_DEMANGLE2 (sp, t0, t1)
>> +	PTR_DEMANGLE2 (sp, t0, t1, t2)
> Isn't t0 already a temporary in PTR_DEMANGE as the code above shows?
> For mangling, dst is the temporary (and thus cannot be SP), for demangling,
> src is the temporary (and thus cannot be SP).
>
> Cheers,
> Wilco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260805/be9aadfa/attachment-0001.htm>


More information about the Libc-alpha mailing list