From: Andreas Arnez Date: Wed, 10 Jul 2024 16:47:07 +0000 (+0200) Subject: s390x: Fix PRNO for SHA-512-DRNG generate X-Git-Tag: VALGRIND_3_24_0~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51689ed4c8e58b22cc822d6dbb7c9d9518c90023;p=thirdparty%2Fvalgrind.git s390x: Fix PRNO for SHA-512-DRNG generate In the implementation of PRNO, when handling the "SHA-512-DRNG generate" operation, the updated length is written back to the wrong register. Also, while the instruction fills the output buffer from right-to-left, the memory tracking is done as if it were the other way around. Fix both of these issues. --- diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index 95116587c..e94e7933c 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -183,8 +183,9 @@ static enum ExtensionError do_extension_PRNO(ThreadState* tst, ULong variant) cc = do_PRNO_insn(func, parms, &addr1, &len1, &addr2, &len2); POST_MEM_WRITE(tst, parms, parms_len); if (mflag == 0) { - WRITE_GPR(tst, r2 + 1, len1); - POST_MEM_WRITE(tst, orig_addr1, orig_len1 - len1); + WRITE_GPR(tst, r1 + 1, len1); + // The operand is filled from right to left + POST_MEM_WRITE(tst, orig_addr1 + len1, orig_len1 - len1); } break; case 114: // TRNG