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

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