[llvm] e37000f - [VE][NFC] Fix use-after-free in PVFMK expansion

Simon Moll via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 01:42:10 PST 2021


Author: Simon Moll
Date: 2021-12-02T10:41:11+01:00
New Revision: e37000f3bff384e20e0696ab4c9126d50030b144

URL: https://github.com/llvm/llvm-project/commit/e37000f3bff384e20e0696ab4c9126d50030b144
DIFF: https://github.com/llvm/llvm-project/commit/e37000f3bff384e20e0696ab4c9126d50030b144.diff

LOG: [VE][NFC] Fix use-after-free in PVFMK expansion

There is custom expansion code for packed VFMK Pseudos in the VE
backend.  This code erased the Pseudo without telling
ExpandPostRAPseudos about it, causing the generic expansion function to
access the erased Pseudo.  This bug triggered in the
test/CodeGen/VE/VELIntrinsics/vfmk.ll test with asan-enabled builds.

Detected by:
sanitizer-x86_64-linux-fast
(https://lab.llvm.org/buildbot/#/builders/5/builds/15393)

Added: 
    

Modified: 
    llvm/lib/Target/VE/VEInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/VE/VEInstrInfo.cpp b/llvm/lib/Target/VE/VEInstrInfo.cpp
index 0624651ed03d7..46846edfeafba 100644
--- a/llvm/lib/Target/VE/VEInstrInfo.cpp
+++ b/llvm/lib/Target/VE/VEInstrInfo.cpp
@@ -956,6 +956,7 @@ bool VEInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
   case VE::VFMKSyvl:
   case VE::VFMKSyvyl:
     expandPseudoVFMK(*this, MI);
+    return true;
   }
   return false;
 }


        


More information about the llvm-commits mailing list