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

caiyinyu <[email protected]> Fri, 7 Aug 2026 10:20:07 +0800
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
LGTM

在 2026/8/5 16:03, mengqinggang 写道:
> The nptl/tst-cancel32 test fails intermittently on LoongArch
> with SIGSEGV at __longjmp:
>
> 0x7ffff7de7f6c <__longjmp+28>   rotri.d         $sp, $t0, 0x11
> 0x7ffff7de7f70 <__longjmp+32>   xor             $sp, $sp, $t1
>
> rotri.d and xor are expanded from PTR_DEMANGLE2.
> If the thread is cancelled between the rotri.d and xor,
> an incomplete sp register causes the SIGSEGV.
>
> Change the destination register of rotri.d to avoid an incomplete sp.
> ---
>   sysdeps/unix/sysv/linux/loongarch/pointer_guard-asm.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/loongarch/pointer_guard-asm.h b/sysdeps/unix/sysv/linux/loongarch/pointer_guard-asm.h
> index 75498545cb..24e27e4092 100644
> --- a/sysdeps/unix/sysv/linux/loongarch/pointer_guard-asm.h
> +++ b/sysdeps/unix/sysv/linux/loongarch/pointer_guard-asm.h
> @@ -40,8 +40,8 @@
>     xor  dst, src, guard; \
>     rotri.d  dst, dst, 47;
>   # define PTR_DEMANGLE2(dst, src, guard) \
> -  rotri.d  dst, src, 17; \
> -  xor  dst, dst, guard;
> +  rotri.d  src, src, 17; \
> +  xor  dst, src, guard;
>   #endif
>   
>   #endif /* POINTER_GUARD_ASM_H */