Blame SOURCES/valgrind-3.18.1-ppc64-lxsibzx-lxsihzx.patch

4db4a6
commit 6e08ee95f7f1b1c3fd434fa380cc5b2cc3e3f7c7
4db4a6
Author: Carl Love <cel@us.ibm.com>
4db4a6
Date:   Fri Oct 29 16:30:33 2021 -0500
4db4a6
4db4a6
    Bug 444571 - PPC, fix the lxsibzx and lxsihzx so they only load their respective sized data.
4db4a6
    
4db4a6
    The lxsibzx was doing a 64-bit load.  The result was initializing
4db4a6
    additional bytes in the register that should not have been initialized.
4db4a6
    The memcheck/tests/linux/dlclose_leak test detected the issue.  The
4db4a6
    code generation uses lxsibzx and stxsibx with -mcpu=power9.  Previously
4db4a6
    the lbz and stb instructions were generated.
4db4a6
    
4db4a6
    The same issue was noted and fixed with the lxsihzx instruction.  The
4db4a6
    memcheck/tests/linux/badrw test now passes as well.
4db4a6
    
4db4a6
    https://bugs.kde.org/show_bug.cgi?id=444571
4db4a6
4db4a6
diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
4db4a6
index d90d566ed..8afd77490 100644
4db4a6
--- a/VEX/priv/guest_ppc_toIR.c
4db4a6
+++ b/VEX/priv/guest_ppc_toIR.c
4db4a6
@@ -25359,19 +25359,17 @@ dis_vx_load ( UInt prefix, UInt theInstr )
4db4a6
 
4db4a6
       else
4db4a6
          irx_addr = mkexpr( EA );
4db4a6
-
4db4a6
-      byte = load( Ity_I64, irx_addr );
4db4a6
+      /* byte load */
4db4a6
+      byte = load( Ity_I8, irx_addr );
4db4a6
       putVSReg( XT, binop( Iop_64HLtoV128,
4db4a6
-                            binop( Iop_And64,
4db4a6
-                                   byte,
4db4a6
-                                   mkU64( 0xFF ) ),
4db4a6
+                           unop( Iop_8Uto64, byte ),
4db4a6
                            mkU64( 0 ) ) );
4db4a6
       break;
4db4a6
    }
4db4a6
 
4db4a6
    case 0x32D: // lxsihzx
4db4a6
    {
4db4a6
-      IRExpr *byte;
4db4a6
+      IRExpr *hword;
4db4a6
       IRExpr* irx_addr;
4db4a6
 
4db4a6
       DIP("lxsihzx %u,r%u,r%u\n", (UInt)XT, rA_addr, rB_addr);
4db4a6
@@ -25382,11 +25380,10 @@ dis_vx_load ( UInt prefix, UInt theInstr )
4db4a6
       else
4db4a6
          irx_addr = mkexpr( EA );
4db4a6
 
4db4a6
-      byte = load( Ity_I64, irx_addr );
4db4a6
+      hword = load( Ity_I16, irx_addr );
4db4a6
       putVSReg( XT, binop( Iop_64HLtoV128,
4db4a6
-                            binop( Iop_And64,
4db4a6
-                                   byte,
4db4a6
-                                   mkU64( 0xFFFF ) ),
4db4a6
+                            unop( Iop_16Uto64,
4db4a6
+                                  hword ),
4db4a6
                            mkU64( 0 ) ) );
4db4a6
       break;
4db4a6
    }