]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 444571 - PPC, fix the lxsibzx and lxsihzx so they only load their respective...
authorCarl Love <cel@us.ibm.com>
Fri, 29 Oct 2021 21:30:33 +0000 (16:30 -0500)
committerCarl Love <cel@us.ibm.com>
Mon, 1 Nov 2021 17:51:32 +0000 (12:51 -0500)
The lxsibzx was doing a 64-bit load.  The result was initializing
additional bytes in the register that should not have been initialized.
The memcheck/tests/linux/dlclose_leak test detected the issue.  The
code generation uses lxsibzx and stxsibx with -mcpu=power9.  Previously
the lbz and stb instructions were generated.

The same issue was noted and fixed with the lxsihzx instruction.  The
memcheck/tests/linux/badrw test now passes as well.

https://bugs.kde.org/show_bug.cgi?id=444571

NEWS
VEX/priv/guest_ppc_toIR.c

diff --git a/NEWS b/NEWS
index 908361039ea7731ff4bc66a5c6cb62aaa100740a..9a49fd0602d07ea53f05fc650af8b55026125e3c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -43,13 +43,14 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 
 444242  s390x: Valgrind crashes on EXRL with negative offset
 444495  dhat/tests/copy fails on s390x
+444571  PPC, fix the lxsibzx and lxsihzx so they only load their respective
+        sized data.
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
 where XXXXXX is the bug number as listed below.
 
 
-
 Release 3.18.0 (15 Oct 2021)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
index d90d566ed15d499e4f9344fdae50238905eeb5ec..8afd7749013fba887a33934d6ee8c2b6aa7dd1e0 100644 (file)
@@ -25359,19 +25359,17 @@ dis_vx_load ( UInt prefix, UInt theInstr )
 
       else
          irx_addr = mkexpr( EA );
-
-      byte = load( Ity_I64, irx_addr );
+      /* byte load */
+      byte = load( Ity_I8, irx_addr );
       putVSReg( XT, binop( Iop_64HLtoV128,
-                            binop( Iop_And64,
-                                   byte,
-                                   mkU64( 0xFF ) ),
+                           unop( Iop_8Uto64, byte ),
                            mkU64( 0 ) ) );
       break;
    }
 
    case 0x32D: // lxsihzx
    {
-      IRExpr *byte;
+      IRExpr *hword;
       IRExpr* irx_addr;
 
       DIP("lxsihzx %u,r%u,r%u\n", (UInt)XT, rA_addr, rB_addr);
@@ -25382,11 +25380,10 @@ dis_vx_load ( UInt prefix, UInt theInstr )
       else
          irx_addr = mkexpr( EA );
 
-      byte = load( Ity_I64, irx_addr );
+      hword = load( Ity_I16, irx_addr );
       putVSReg( XT, binop( Iop_64HLtoV128,
-                            binop( Iop_And64,
-                                   byte,
-                                   mkU64( 0xFFFF ) ),
+                            unop( Iop_16Uto64,
+                                  hword ),
                            mkU64( 0 ) ) );
       break;
    }