From: Andreas Arnez Date: Wed, 18 Mar 2020 11:24:25 +0000 (+0100) Subject: Bug 417281 - s390x: Fix register usage of conditional moves X-Git-Tag: VALGRIND_3_16_0~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=942a48c1db83ffbcbf1f5781d5607f3b42849b67;p=thirdparty%2Fvalgrind.git Bug 417281 - s390x: Fix register usage of conditional moves The s390x register usage callback marks the target register of a conditional move as HRmWrite only. It fails to mention the fact that the target register is also an input to the insn (unless the condition is "never" or "always"). This was discovered while investigating "grail" failures on s390x and fixes the majority of them. --- diff --git a/NEWS b/NEWS index d7852320e5..52377430ce 100644 --- a/NEWS +++ b/NEWS @@ -127,6 +127,7 @@ where XXXXXX is the bug number as listed below. 417906 clone with CLONE_VFORK and no CLONE_VM fails 418435 s390x: memcmp test yields extra "Conditional jump or move depends on uninitialised value(s)" +417281 s390x: /bin/true segfaults with "grail" enabled n-i-bz Fix minor one time leaks in dhat. n-i-bz Add --run-cxx-freeres=no in outer args to avoid inner crashes. n-i-bz Add support for the Linux io_uring system calls diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 80e56f603a..b9b2158190 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -676,8 +676,18 @@ s390_insn_get_reg_usage(HRegUsage *u, const s390_insn *insn) break; case S390_INSN_COND_MOVE: - s390_opnd_RMI_get_reg_usage(u, insn->variant.cond_move.src); - addHRegUse(u, HRmWrite, insn->variant.cond_move.dst); + switch (insn->variant.cond_move.cond) { + case S390_CC_NEVER: + break; + case S390_CC_ALWAYS: + s390_opnd_RMI_get_reg_usage(u, insn->variant.cond_move.src); + addHRegUse(u, HRmWrite, insn->variant.cond_move.dst); + break; + default: + s390_opnd_RMI_get_reg_usage(u, insn->variant.cond_move.src); + addHRegUse(u, HRmModify, insn->variant.cond_move.dst); + break; + } break; case S390_INSN_ALU: diff --git a/docs/internals/3_15_BUGSTATUS.txt b/docs/internals/3_15_BUGSTATUS.txt index ac4b5f48f5..9509426a04 100644 --- a/docs/internals/3_15_BUGSTATUS.txt +++ b/docs/internals/3_15_BUGSTATUS.txt @@ -204,9 +204,6 @@ Uhmm, MUSL .417266 Make memcheck/tests/linux/sigqueue usable with musl Uhmm, MUSL -.417281 s390x: /bin/true segfaults with "grail" enabled -Ongoing - .417377 False-positive "uninitialised value(s)" reports from memcheck .417572 unhandled instruction bytes: 0xC5 0x79 0xD6 0xED 0xC5 0xF9 0x51