From b37f03b90c18a54d21cd7bded252da0a84a7ba4c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 24 May 2019 14:57:38 +0200 Subject: [PATCH] 3.15.0-6 - Add valgrind-3.15.0-s390x-wrap-drd.patch --- valgrind-3.15.0-s390x-wrap-drd.patch | 194 +++++++++++++++++++++++++++ valgrind.spec | 9 +- 2 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 valgrind-3.15.0-s390x-wrap-drd.patch diff --git a/valgrind-3.15.0-s390x-wrap-drd.patch b/valgrind-3.15.0-s390x-wrap-drd.patch new file mode 100644 index 0000000..be5adb5 --- /dev/null +++ b/valgrind-3.15.0-s390x-wrap-drd.patch @@ -0,0 +1,194 @@ +From bfa89eae00ba7067445bc0532e1f17405c062954 Mon Sep 17 00:00:00 2001 +From: Andreas Arnez +Date: Thu, 23 May 2019 17:17:43 +0200 +Subject: [PATCH] Bug 407764 - s390x: drd fails on z13 due to function wrapping + issue + +The s390x-specific inline assembly macros for function wrapping in +include/valgrind.h have a few issues. + +When the compiler uses vector registers, such as with "-march=z13", all +vector registers must be declared as clobbered by the callee. Because +this is missing, many drd test failures are seen with "-march=z13". + +Also, the inline assemblies write the return value into the target +register before restoring r11. If r11 is used as the target register, +this means that the restore operation corrupts the result. This bug +causes failures with memcheck's "wrap6" test case. + +These bugs are fixed. The clobber list is extended by the vector +registers (if appropriate), and the target register is now written at the +end, after restoring r11. +--- + include/valgrind.h | 38 +++++++++++++++++++++++--------------- + 1 file changed, 23 insertions(+), 15 deletions(-) + +diff --git a/include/valgrind.h b/include/valgrind.h +index f071bd392..815efa893 100644 +--- a/include/valgrind.h ++++ b/include/valgrind.h +@@ -4687,8 +4687,16 @@ typedef + r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the + function a proper return address. All others are ABI defined call + clobbers. */ +-#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \ +- "f0","f1","f2","f3","f4","f5","f6","f7" ++#if defined(__VX__) || defined(__S390_VX__) ++#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14", \ ++ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", \ ++ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", \ ++ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", \ ++ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31" ++#else ++#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14", \ ++ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7" ++#endif + + /* Nb: Although r11 is modified in the asm snippets below (inside + VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for +@@ -4710,9 +4718,9 @@ typedef + "aghi 15,-160\n\t" \ + "lg 1, 0(1)\n\t" /* target->r1 */ \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,160\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "d" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \ +@@ -4734,9 +4742,9 @@ typedef + "lg 2, 8(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,160\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \ +@@ -4759,9 +4767,9 @@ typedef + "lg 3,16(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,160\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \ +@@ -4786,9 +4794,9 @@ typedef + "lg 4,24(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,160\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \ +@@ -4815,9 +4823,9 @@ typedef + "lg 5,32(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,160\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \ +@@ -4846,9 +4854,9 @@ typedef + "lg 6,40(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,160\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -4880,9 +4888,9 @@ typedef + "mvc 160(8,15), 48(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,168\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -4916,9 +4924,9 @@ typedef + "mvc 168(8,15), 56(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,176\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -4954,9 +4962,9 @@ typedef + "mvc 176(8,15), 64(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,184\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -4994,9 +5002,9 @@ typedef + "mvc 184(8,15), 72(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,192\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -5036,9 +5044,9 @@ typedef + "mvc 192(8,15), 80(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,200\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -5080,9 +5088,9 @@ typedef + "mvc 200(8,15), 88(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,208\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +@@ -5126,9 +5134,9 @@ typedef + "mvc 208(8,15), 96(1)\n\t" \ + "lg 1, 0(1)\n\t" \ + VALGRIND_CALL_NOREDIR_R1 \ +- "lgr %0, 2\n\t" \ + "aghi 15,216\n\t" \ + VALGRIND_CFI_EPILOGUE \ ++ "lgr %0, 2\n\t" \ + : /*out*/ "=d" (_res) \ + : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \ + : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ +-- +2.17.0 + diff --git a/valgrind.spec b/valgrind.spec index 7cdcae2..ed99ece 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Tool for finding memory management bugs in programs Name: %{?scl_prefix}valgrind Version: 3.15.0 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 1 License: GPLv2+ URL: http://www.valgrind.org/ @@ -112,6 +112,9 @@ Patch11: valgrind-3.15.0-scalar-arm64.patch # commit abc09f Make memcheck/tests/x86-linux/scalar test work under root. Patch12: valgrind-3.15.0-scalar-x86.patch +# KDE#407764 s390x: drd fails on z13 due to function wrapping issue +Patch13: valgrind-3.15.0-s390x-wrap-drd.patch + BuildRequires: glibc-devel %if %{build_openmpi} @@ -250,6 +253,7 @@ Valgrind User Manual for details. %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 %build @@ -470,6 +474,9 @@ fi %endif %changelog +* Fri May 24 2019 Mark Wielaard - 3.15.0-6 +- Add valgrind-3.15.0-s390x-wrap-drd.patch + * Mon May 20 2019 Mark Wielaard - 3.15.0-5 - Add valgrind-3.15.0-exp-sgcheck-no-aarch64.patch - Add valgrind-3.15.0-scalar-arm64.patch