From: Paul E. Murphy Date: Fri, 21 Aug 2015 19:39:01 +0000 (-0500) Subject: powerpc: Fix tabort usage in syscalls X-Git-Tag: glibc-2.23~591 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18173559a23e28055640b152e623d9f0d40ecca8;p=thirdparty%2Fglibc.git powerpc: Fix tabort usage in syscalls Fix usage of tabort in generated syscalls. r0 has special meaning when used with this instruction, thus it will not generate persistent errors, nor return an error code. This mitigates poor CPU usage when performing elided critical sections. Additionally, transactions should be aborted when entering a user invoked syscall. Otherwise the results of the transaction may be undefined. 2015-08-25 Paul E. Murphy * sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use register other than r0 for tabort, it has special meaning. * sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise * sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort transaction before starting syscall. --- diff --git a/ChangeLog b/ChangeLog index 13fc3fb98a0..6e55d886a6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-08-25 Paul E. Murphy + + * sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use + register other than r0 for tabort, it has special meaning. + * sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise + * sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort + transaction before starting syscall. + 2015-08-25 Rajalakshmi Srinivasaraghavan * sysdeps/powerpc/powerpc64/power7/strstr.S: Handle worst case. diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h index e16fe3e2241..ecb492a5aba 100644 --- a/sysdeps/powerpc/powerpc32/sysdep.h +++ b/sysdeps/powerpc/powerpc32/sysdep.h @@ -95,8 +95,8 @@ GOT_LABEL: ; \ lwz 0,TM_CAPABLE(2); \ cmpwi 0,0; \ beq 1f; \ - li 0,_ABORT_SYSCALL; \ - tabort. 0; \ + li 11,_ABORT_SYSCALL; \ + tabort. 11; \ .align 4; \ 1: #else diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index bf2a884b99a..a9d37ad4373 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -279,8 +279,8 @@ LT_LABELSUFFIX(name,_name_end): ; \ lwz 0,TM_CAPABLE(13); \ cmpwi 0,0; \ beq 1f; \ - li 0,_ABORT_SYSCALL; \ - tabort. 0; \ + li 11,_ABORT_SYSCALL; \ + tabort. 11; \ .align 4; \ 1: #else diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S index 157e3e32961..44773038bc3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/syscall.S +++ b/sysdeps/unix/sysv/linux/powerpc/syscall.S @@ -18,6 +18,7 @@ #include ENTRY (syscall) + ABORT_TRANSACTION mr r0,r3 mr r3,r4 mr r4,r5