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

Yinyu Cai via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4b0c2842a85f2f3cbe4aa11bd8aea18487982ba8

commit 4b0c2842a85f2f3cbe4aa11bd8aea18487982ba8
Author: mengqinggang <[email protected]>
Date:   Wed Aug 5 16:03:34 2026 +0800

    LoongArch: Fix intermittent nptl/tst-cancel32 failure
    
    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.

Diff:
---
 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 */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.