]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Fix handling of scv return error codes [BZ #27892]
authorNicholas Piggin <npiggin@gmail.com>
Thu, 20 May 2021 14:00:36 +0000 (11:00 -0300)
committerMatheus Castanho <msc@linux.ibm.com>
Mon, 24 May 2021 20:05:07 +0000 (17:05 -0300)
When using scv for templated ASM syscalls, current code interprets any
negative return value as error, but the only valid error codes are in
the range -4095..-1 according to the ABI.

This commit also fixes 'signal.gen.test' strace test, where the issue
was first identified.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
(cherry picked from commit 7de36744ee1325f35d3fe0ca079dd33c40b12267)

NEWS
sysdeps/powerpc/powerpc64/sysdep.h

diff --git a/NEWS b/NEWS
index 0877a13daeb38bd0b516a4fab6a2728cace31b9a..a6202ad05895ef0b08095f72c8ef9bb253aaef27 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ The following bugs are resolved with this release:
   [27651] Performance regression after updating to 2.33
   [27706] select fails to update timeout on error
   [27744] Support different libpthread/ld.so load orders for gdb -p
+  [27892] powerpc: scv ABI error handling fails to check IS_ERR_VALUE
 \f
 Version 2.33
 
index c57bb1c05d02f6636689532526fa11beaeaff5ae..1ea4c3b9172951684b7042e0c276a1d77cc737c0 100644 (file)
@@ -398,8 +398,9 @@ LT_LABELSUFFIX(name,_name_end): ; \
 #endif
 
 #define RET_SCV \
-    cmpdi r3,0; \
-    bgelr+; \
+    li r9,-4095; \
+    cmpld r3,r9; \
+    bltlr+; \
     neg r3,r3;
 
 #define RET_SC \