public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [PATCH COMMITTED 2.33] powerpc: Fix handling of scv return error codes [BZ #27892]
@ 2021-05-24 20:19 Matheus Castanho
  0 siblings, 0 replies; only message in thread
From: Matheus Castanho @ 2021-05-24 20:19 UTC (permalink / raw)
  To: libc-stable

From: Nicholas Piggin <npiggin@gmail.com>

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                               | 1 +
 sysdeps/powerpc/powerpc64/sysdep.h | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 0877a13dae..a6202ad058 100644
--- 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
 
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index c57bb1c05d..1ea4c3b917 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -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 \
-- 
2.31.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-24 20:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 20:19 [PATCH COMMITTED 2.33] powerpc: Fix handling of scv return error codes [BZ #27892] Matheus Castanho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).