mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[NewPM] Port Msan
Summary: Keeping msan a function pass requires replacing the module level initialization: That means, don't define a ctor function which calls __msan_init, instead just declare the init function at the first access, and add that to the global ctors list. Changes: - Pull the actual sanitizer and the wrapper pass apart. - Add a newpm msan pass. The function pass inserts calls to runtime library functions, for which it inserts declarations as necessary. - Update tests. Caveats: - There is one test that I dropped, because it specifically tested the definition of the ctor. Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji Differential Revision: https://reviews.llvm.org/D55647 llvm-svn: 350305
This commit is contained in:
parent
ce30daaf5b
commit
65df098609
@ -16,6 +16,7 @@
|
|||||||
#include "llvm/IR/LegacyPassManager.h"
|
#include "llvm/IR/LegacyPassManager.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
|
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -31,8 +32,8 @@ void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
|
|||||||
unwrap(PM)->add(createThreadSanitizerPass());
|
unwrap(PM)->add(createThreadSanitizerPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMAddMemorySanitizerPass(LLVMPassManagerRef PM) {
|
void LLVMAddMemorySanitizerLegacyPassPass(LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(createMemorySanitizerPass());
|
unwrap(PM)->add(createMemorySanitizerLegacyPassPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM,
|
void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM,
|
||||||
|
@ -27,7 +27,7 @@ extern "C" {
|
|||||||
void LLVMAddAddressSanitizerFunctionPass(LLVMPassManagerRef PM);
|
void LLVMAddAddressSanitizerFunctionPass(LLVMPassManagerRef PM);
|
||||||
void LLVMAddAddressSanitizerModulePass(LLVMPassManagerRef PM);
|
void LLVMAddAddressSanitizerModulePass(LLVMPassManagerRef PM);
|
||||||
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM);
|
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM);
|
||||||
void LLVMAddMemorySanitizerPass(LLVMPassManagerRef PM);
|
void LLVMAddMemorySanitizerLegacyPassPass(LLVMPassManagerRef PM);
|
||||||
void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, int ABIListFilesNum,
|
void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, int ABIListFilesNum,
|
||||||
const char **ABIListFiles);
|
const char **ABIListFiles);
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ func (pm PassManager) AddThreadSanitizerPass() {
|
|||||||
C.LLVMAddThreadSanitizerPass(pm.C)
|
C.LLVMAddThreadSanitizerPass(pm.C)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pm PassManager) AddMemorySanitizerPass() {
|
func (pm PassManager) AddMemorySanitizerLegacyPassPass() {
|
||||||
C.LLVMAddMemorySanitizerPass(pm.C)
|
C.LLVMAddMemorySanitizerLegacyPassPass(pm.C)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) {
|
func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) {
|
||||||
|
@ -273,7 +273,7 @@ void initializeMemDerefPrinterPass(PassRegistry&);
|
|||||||
void initializeMemoryDependenceWrapperPassPass(PassRegistry&);
|
void initializeMemoryDependenceWrapperPassPass(PassRegistry&);
|
||||||
void initializeMemorySSAPrinterLegacyPassPass(PassRegistry&);
|
void initializeMemorySSAPrinterLegacyPassPass(PassRegistry&);
|
||||||
void initializeMemorySSAWrapperPassPass(PassRegistry&);
|
void initializeMemorySSAWrapperPassPass(PassRegistry&);
|
||||||
void initializeMemorySanitizerPass(PassRegistry&);
|
void initializeMemorySanitizerLegacyPassPass(PassRegistry&);
|
||||||
void initializeMergeFunctionsPass(PassRegistry&);
|
void initializeMergeFunctionsPass(PassRegistry&);
|
||||||
void initializeMergeICmpsPass(PassRegistry&);
|
void initializeMergeICmpsPass(PassRegistry&);
|
||||||
void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry&);
|
void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry&);
|
||||||
|
@ -152,11 +152,6 @@ ModulePass *createAddressSanitizerModulePass(bool CompileKernel = false,
|
|||||||
bool UseGlobalsGC = true,
|
bool UseGlobalsGC = true,
|
||||||
bool UseOdrIndicator = true);
|
bool UseOdrIndicator = true);
|
||||||
|
|
||||||
// Insert MemorySanitizer instrumentation (detection of uninitialized reads)
|
|
||||||
FunctionPass *createMemorySanitizerPass(int TrackOrigins = 0,
|
|
||||||
bool Recover = false,
|
|
||||||
bool EnableKmsan = false);
|
|
||||||
|
|
||||||
FunctionPass *createHWAddressSanitizerPass(bool CompileKernel = false,
|
FunctionPass *createHWAddressSanitizerPass(bool CompileKernel = false,
|
||||||
bool Recover = false);
|
bool Recover = false);
|
||||||
|
|
||||||
@ -230,7 +225,6 @@ static inline uint32_t scaleBranchCount(uint64_t Count, uint64_t Scale) {
|
|||||||
assert(Scaled <= std::numeric_limits<uint32_t>::max() && "overflow 32-bits");
|
assert(Scaled <= std::numeric_limits<uint32_t>::max() && "overflow 32-bits");
|
||||||
return Scaled;
|
return Scaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif // LLVM_TRANSFORMS_INSTRUMENTATION_H
|
#endif // LLVM_TRANSFORMS_INSTRUMENTATION_H
|
||||||
|
48
include/llvm/Transforms/Instrumentation/MemorySanitizer.h
Normal file
48
include/llvm/Transforms/Instrumentation/MemorySanitizer.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
//===- Transforms/Instrumentation/MemorySanitizer.h - MSan Pass -----------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// This file defines the memoy sanitizer pass.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
|
||||||
|
#define LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
|
||||||
|
|
||||||
|
#include "llvm/IR/PassManager.h"
|
||||||
|
#include "llvm/Pass.h"
|
||||||
|
|
||||||
|
namespace llvm {
|
||||||
|
|
||||||
|
// Insert MemorySanitizer instrumentation (detection of uninitialized reads)
|
||||||
|
FunctionPass *createMemorySanitizerLegacyPassPass(int TrackOrigins = 0,
|
||||||
|
bool Recover = false,
|
||||||
|
bool EnableKmsan = false);
|
||||||
|
|
||||||
|
/// A function pass for msan instrumentation.
|
||||||
|
///
|
||||||
|
/// Instruments functions to detect unitialized reads. This function pass
|
||||||
|
/// inserts calls to runtime library functions. If the functions aren't declared
|
||||||
|
/// yet, the pass inserts the declarations. Otherwise the existing globals are
|
||||||
|
/// used.
|
||||||
|
struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
|
||||||
|
MemorySanitizerPass(int TrackOrigins = 0, bool Recover = false,
|
||||||
|
bool EnableKmsan = false)
|
||||||
|
: TrackOrigins(TrackOrigins), Recover(Recover), EnableKmsan(EnableKmsan) {
|
||||||
|
}
|
||||||
|
|
||||||
|
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int TrackOrigins;
|
||||||
|
bool Recover;
|
||||||
|
bool EnableKmsan;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H */
|
@ -58,6 +58,11 @@ std::pair<Function *, Function *> createSanitizerCtorAndInitFunctions(
|
|||||||
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
|
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
|
||||||
StringRef VersionCheckName = StringRef());
|
StringRef VersionCheckName = StringRef());
|
||||||
|
|
||||||
|
// Creates and returns a sanitizer init function without argument if it doesn't
|
||||||
|
// exist, and adds it to the global constructors list. Otherwise it returns the
|
||||||
|
// existing function.
|
||||||
|
Function *getOrCreateInitFunction(Module &M, StringRef Name);
|
||||||
|
|
||||||
/// Rename all the anon globals in the module using a hash computed from
|
/// Rename all the anon globals in the module using a hash computed from
|
||||||
/// the list of public globals in the module.
|
/// the list of public globals in the module.
|
||||||
bool nameUnamedGlobals(Module &M);
|
bool nameUnamedGlobals(Module &M);
|
||||||
|
@ -88,11 +88,13 @@
|
|||||||
#include "llvm/Transforms/IPO/SyntheticCountsPropagation.h"
|
#include "llvm/Transforms/IPO/SyntheticCountsPropagation.h"
|
||||||
#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
|
#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
|
||||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||||
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
#include "llvm/Transforms/Instrumentation/BoundsChecking.h"
|
#include "llvm/Transforms/Instrumentation/BoundsChecking.h"
|
||||||
#include "llvm/Transforms/Instrumentation/CGProfile.h"
|
#include "llvm/Transforms/Instrumentation/CGProfile.h"
|
||||||
#include "llvm/Transforms/Instrumentation/ControlHeightReduction.h"
|
#include "llvm/Transforms/Instrumentation/ControlHeightReduction.h"
|
||||||
#include "llvm/Transforms/Instrumentation/GCOVProfiler.h"
|
#include "llvm/Transforms/Instrumentation/GCOVProfiler.h"
|
||||||
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
|
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
|
||||||
|
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
|
||||||
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
|
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
|
||||||
#include "llvm/Transforms/Scalar/ADCE.h"
|
#include "llvm/Transforms/Scalar/ADCE.h"
|
||||||
#include "llvm/Transforms/Scalar/AlignmentFromAssumptions.h"
|
#include "llvm/Transforms/Scalar/AlignmentFromAssumptions.h"
|
||||||
|
@ -231,6 +231,7 @@ FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
|
|||||||
FUNCTION_PASS("view-cfg", CFGViewerPass())
|
FUNCTION_PASS("view-cfg", CFGViewerPass())
|
||||||
FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
|
FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
|
||||||
FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
|
FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
|
||||||
|
FUNCTION_PASS("msan", MemorySanitizerPass())
|
||||||
#undef FUNCTION_PASS
|
#undef FUNCTION_PASS
|
||||||
|
|
||||||
#ifndef LOOP_ANALYSIS
|
#ifndef LOOP_ANALYSIS
|
||||||
|
@ -111,7 +111,7 @@ void llvm::initializeInstrumentation(PassRegistry &Registry) {
|
|||||||
initializePGOIndirectCallPromotionLegacyPassPass(Registry);
|
initializePGOIndirectCallPromotionLegacyPassPass(Registry);
|
||||||
initializePGOMemOPSizeOptLegacyPassPass(Registry);
|
initializePGOMemOPSizeOptLegacyPassPass(Registry);
|
||||||
initializeInstrProfilingLegacyPassPass(Registry);
|
initializeInstrProfilingLegacyPassPass(Registry);
|
||||||
initializeMemorySanitizerPass(Registry);
|
initializeMemorySanitizerLegacyPassPass(Registry);
|
||||||
initializeHWAddressSanitizerPass(Registry);
|
initializeHWAddressSanitizerPass(Registry);
|
||||||
initializeThreadSanitizerPass(Registry);
|
initializeThreadSanitizerPass(Registry);
|
||||||
initializeSanitizerCoverageModulePass(Registry);
|
initializeSanitizerCoverageModulePass(Registry);
|
||||||
|
@ -140,6 +140,7 @@
|
|||||||
///
|
///
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
|
||||||
#include "llvm/ADT/APInt.h"
|
#include "llvm/ADT/APInt.h"
|
||||||
#include "llvm/ADT/ArrayRef.h"
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
#include "llvm/ADT/DepthFirstIterator.h"
|
#include "llvm/ADT/DepthFirstIterator.h"
|
||||||
@ -149,7 +150,6 @@
|
|||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/ADT/Triple.h"
|
#include "llvm/ADT/Triple.h"
|
||||||
#include "llvm/Analysis/TargetLibraryInfo.h"
|
#include "llvm/Analysis/TargetLibraryInfo.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
|
||||||
#include "llvm/IR/Argument.h"
|
#include "llvm/IR/Argument.h"
|
||||||
#include "llvm/IR/Attributes.h"
|
#include "llvm/IR/Attributes.h"
|
||||||
#include "llvm/IR/BasicBlock.h"
|
#include "llvm/IR/BasicBlock.h"
|
||||||
@ -187,6 +187,7 @@
|
|||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/Transforms/Utils/ModuleUtils.h"
|
#include "llvm/Transforms/Utils/ModuleUtils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -320,7 +321,6 @@ static cl::opt<unsigned long long> ClOriginBase("msan-origin-base",
|
|||||||
cl::desc("Define custom MSan OriginBase"),
|
cl::desc("Define custom MSan OriginBase"),
|
||||||
cl::Hidden, cl::init(0));
|
cl::Hidden, cl::init(0));
|
||||||
|
|
||||||
static const char *const kMsanModuleCtorName = "msan.module_ctor";
|
|
||||||
static const char *const kMsanInitName = "__msan_init";
|
static const char *const kMsanInitName = "__msan_init";
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -446,19 +446,16 @@ static const PlatformMemoryMapParams NetBSD_X86_MemoryMapParams = {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/// An instrumentation pass implementing detection of uninitialized
|
/// Instrument functions of a module to detect uninitialized reads.
|
||||||
/// reads.
|
|
||||||
///
|
///
|
||||||
/// MemorySanitizer: instrument the code in module to find
|
/// Instantiating MemorySanitizer inserts the msan runtime library API function
|
||||||
/// uninitialized reads.
|
/// declarations into the module if they don't exist already. Instantiating
|
||||||
class MemorySanitizer : public FunctionPass {
|
/// ensures the __msan_init function is in the list of global constructors for
|
||||||
|
/// the module.
|
||||||
|
class MemorySanitizer {
|
||||||
public:
|
public:
|
||||||
// Pass identification, replacement for typeid.
|
MemorySanitizer(Module &M, int TrackOrigins = 0, bool Recover = false,
|
||||||
static char ID;
|
bool EnableKmsan = false) {
|
||||||
|
|
||||||
MemorySanitizer(int TrackOrigins = 0, bool Recover = false,
|
|
||||||
bool EnableKmsan = false)
|
|
||||||
: FunctionPass(ID) {
|
|
||||||
this->CompileKernel =
|
this->CompileKernel =
|
||||||
ClEnableKmsan.getNumOccurrences() > 0 ? ClEnableKmsan : EnableKmsan;
|
ClEnableKmsan.getNumOccurrences() > 0 ? ClEnableKmsan : EnableKmsan;
|
||||||
if (ClTrackOrigins.getNumOccurrences() > 0)
|
if (ClTrackOrigins.getNumOccurrences() > 0)
|
||||||
@ -468,15 +465,16 @@ public:
|
|||||||
this->Recover = ClKeepGoing.getNumOccurrences() > 0
|
this->Recover = ClKeepGoing.getNumOccurrences() > 0
|
||||||
? ClKeepGoing
|
? ClKeepGoing
|
||||||
: (this->CompileKernel | Recover);
|
: (this->CompileKernel | Recover);
|
||||||
}
|
initializeModule(M);
|
||||||
StringRef getPassName() const override { return "MemorySanitizer"; }
|
|
||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
|
||||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnFunction(Function &F) override;
|
// MSan cannot be moved or copied because of MapParams.
|
||||||
bool doInitialization(Module &M) override;
|
MemorySanitizer(MemorySanitizer &&) = delete;
|
||||||
|
MemorySanitizer &operator=(MemorySanitizer &&) = delete;
|
||||||
|
MemorySanitizer(const MemorySanitizer &) = delete;
|
||||||
|
MemorySanitizer &operator=(const MemorySanitizer &) = delete;
|
||||||
|
|
||||||
|
bool sanitizeFunction(Function &F, TargetLibraryInfo &TLI);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct MemorySanitizerVisitor;
|
friend struct MemorySanitizerVisitor;
|
||||||
@ -485,13 +483,13 @@ private:
|
|||||||
friend struct VarArgAArch64Helper;
|
friend struct VarArgAArch64Helper;
|
||||||
friend struct VarArgPowerPC64Helper;
|
friend struct VarArgPowerPC64Helper;
|
||||||
|
|
||||||
|
void initializeModule(Module &M);
|
||||||
void initializeCallbacks(Module &M);
|
void initializeCallbacks(Module &M);
|
||||||
void createKernelApi(Module &M);
|
void createKernelApi(Module &M);
|
||||||
void createUserspaceApi(Module &M);
|
void createUserspaceApi(Module &M);
|
||||||
|
|
||||||
/// True if we're compiling the Linux kernel.
|
/// True if we're compiling the Linux kernel.
|
||||||
bool CompileKernel;
|
bool CompileKernel;
|
||||||
|
|
||||||
/// Track origins (allocation points) of uninitialized values.
|
/// Track origins (allocation points) of uninitialized values.
|
||||||
int TrackOrigins;
|
int TrackOrigins;
|
||||||
bool Recover;
|
bool Recover;
|
||||||
@ -588,25 +586,61 @@ private:
|
|||||||
|
|
||||||
/// An empty volatile inline asm that prevents callback merge.
|
/// An empty volatile inline asm that prevents callback merge.
|
||||||
InlineAsm *EmptyAsm;
|
InlineAsm *EmptyAsm;
|
||||||
|
};
|
||||||
|
|
||||||
Function *MsanCtorFunction;
|
/// A legacy function pass for msan instrumentation.
|
||||||
|
///
|
||||||
|
/// Instruments functions to detect unitialized reads.
|
||||||
|
struct MemorySanitizerLegacyPass : public FunctionPass {
|
||||||
|
// Pass identification, replacement for typeid.
|
||||||
|
static char ID;
|
||||||
|
|
||||||
|
MemorySanitizerLegacyPass(int TrackOrigins = 0, bool Recover = false,
|
||||||
|
bool EnableKmsan = false)
|
||||||
|
: FunctionPass(ID), TrackOrigins(TrackOrigins), Recover(Recover),
|
||||||
|
EnableKmsan(EnableKmsan) {}
|
||||||
|
StringRef getPassName() const override { return "MemorySanitizerLegacyPass"; }
|
||||||
|
|
||||||
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool runOnFunction(Function &F) override {
|
||||||
|
return MSan->sanitizeFunction(
|
||||||
|
F, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI());
|
||||||
|
}
|
||||||
|
bool doInitialization(Module &M) override;
|
||||||
|
|
||||||
|
Optional<MemorySanitizer> MSan;
|
||||||
|
int TrackOrigins;
|
||||||
|
bool Recover;
|
||||||
|
bool EnableKmsan;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
char MemorySanitizer::ID = 0;
|
PreservedAnalyses MemorySanitizerPass::run(Function &F,
|
||||||
|
FunctionAnalysisManager &FAM) {
|
||||||
|
MemorySanitizer Msan(*F.getParent(), TrackOrigins, Recover, EnableKmsan);
|
||||||
|
if (Msan.sanitizeFunction(F, FAM.getResult<TargetLibraryAnalysis>(F)))
|
||||||
|
return PreservedAnalyses::none();
|
||||||
|
return PreservedAnalyses::all();
|
||||||
|
}
|
||||||
|
|
||||||
INITIALIZE_PASS_BEGIN(
|
char MemorySanitizerLegacyPass::ID = 0;
|
||||||
MemorySanitizer, "msan",
|
|
||||||
"MemorySanitizer: detects uninitialized reads.", false, false)
|
INITIALIZE_PASS_BEGIN(MemorySanitizerLegacyPass, "msan",
|
||||||
|
"MemorySanitizer: detects uninitialized reads.", false,
|
||||||
|
false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(
|
INITIALIZE_PASS_END(MemorySanitizerLegacyPass, "msan",
|
||||||
MemorySanitizer, "msan",
|
"MemorySanitizer: detects uninitialized reads.", false,
|
||||||
"MemorySanitizer: detects uninitialized reads.", false, false)
|
false)
|
||||||
|
|
||||||
FunctionPass *llvm::createMemorySanitizerPass(int TrackOrigins, bool Recover,
|
FunctionPass *llvm::createMemorySanitizerLegacyPassPass(int TrackOrigins,
|
||||||
|
bool Recover,
|
||||||
bool CompileKernel) {
|
bool CompileKernel) {
|
||||||
return new MemorySanitizer(TrackOrigins, Recover, CompileKernel);
|
return new MemorySanitizerLegacyPass(TrackOrigins, Recover, CompileKernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a non-const global initialized with the given string.
|
/// Create a non-const global initialized with the given string.
|
||||||
@ -683,6 +717,14 @@ void MemorySanitizer::createKernelApi(Module &M) {
|
|||||||
"__msan_unpoison_alloca", IRB.getVoidTy(), IRB.getInt8PtrTy(), IntptrTy);
|
"__msan_unpoison_alloca", IRB.getVoidTy(), IRB.getInt8PtrTy(), IntptrTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Constant *getOrInsertGlobal(Module &M, StringRef Name, Type *Ty) {
|
||||||
|
return M.getOrInsertGlobal(Name, Ty, [&] {
|
||||||
|
return new GlobalVariable(M, Ty, false, GlobalVariable::ExternalLinkage,
|
||||||
|
nullptr, Name, nullptr,
|
||||||
|
GlobalVariable::InitialExecTLSModel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Insert declarations for userspace-specific functions and globals.
|
/// Insert declarations for userspace-specific functions and globals.
|
||||||
void MemorySanitizer::createUserspaceApi(Module &M) {
|
void MemorySanitizer::createUserspaceApi(Module &M) {
|
||||||
IRBuilder<> IRB(*C);
|
IRBuilder<> IRB(*C);
|
||||||
@ -694,42 +736,31 @@ void MemorySanitizer::createUserspaceApi(Module &M) {
|
|||||||
WarningFn = M.getOrInsertFunction(WarningFnName, IRB.getVoidTy());
|
WarningFn = M.getOrInsertFunction(WarningFnName, IRB.getVoidTy());
|
||||||
|
|
||||||
// Create the global TLS variables.
|
// Create the global TLS variables.
|
||||||
RetvalTLS = new GlobalVariable(
|
RetvalTLS =
|
||||||
M, ArrayType::get(IRB.getInt64Ty(), kRetvalTLSSize / 8), false,
|
getOrInsertGlobal(M, "__msan_retval_tls",
|
||||||
GlobalVariable::ExternalLinkage, nullptr, "__msan_retval_tls", nullptr,
|
ArrayType::get(IRB.getInt64Ty(), kRetvalTLSSize / 8));
|
||||||
GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
RetvalOriginTLS = new GlobalVariable(
|
RetvalOriginTLS = getOrInsertGlobal(M, "__msan_retval_origin_tls", OriginTy);
|
||||||
M, OriginTy, false, GlobalVariable::ExternalLinkage, nullptr,
|
|
||||||
"__msan_retval_origin_tls", nullptr, GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
ParamTLS = new GlobalVariable(
|
ParamTLS =
|
||||||
M, ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8), false,
|
getOrInsertGlobal(M, "__msan_param_tls",
|
||||||
GlobalVariable::ExternalLinkage, nullptr, "__msan_param_tls", nullptr,
|
ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8));
|
||||||
GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
ParamOriginTLS = new GlobalVariable(
|
ParamOriginTLS =
|
||||||
M, ArrayType::get(OriginTy, kParamTLSSize / 4), false,
|
getOrInsertGlobal(M, "__msan_param_origin_tls",
|
||||||
GlobalVariable::ExternalLinkage, nullptr, "__msan_param_origin_tls",
|
ArrayType::get(OriginTy, kParamTLSSize / 4));
|
||||||
nullptr, GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
VAArgTLS = new GlobalVariable(
|
VAArgTLS =
|
||||||
M, ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8), false,
|
getOrInsertGlobal(M, "__msan_va_arg_tls",
|
||||||
GlobalVariable::ExternalLinkage, nullptr, "__msan_va_arg_tls", nullptr,
|
ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8));
|
||||||
GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
VAArgOriginTLS = new GlobalVariable(
|
VAArgOriginTLS =
|
||||||
M, ArrayType::get(OriginTy, kParamTLSSize / 4), false,
|
getOrInsertGlobal(M, "__msan_va_arg_origin_tls",
|
||||||
GlobalVariable::ExternalLinkage, nullptr, "__msan_va_arg_origin_tls",
|
ArrayType::get(OriginTy, kParamTLSSize / 4));
|
||||||
nullptr, GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
VAArgOverflowSizeTLS = new GlobalVariable(
|
VAArgOverflowSizeTLS =
|
||||||
M, IRB.getInt64Ty(), false, GlobalVariable::ExternalLinkage, nullptr,
|
getOrInsertGlobal(M, "__msan_va_arg_overflow_size_tls", IRB.getInt64Ty());
|
||||||
"__msan_va_arg_overflow_size_tls", nullptr,
|
OriginTLS = getOrInsertGlobal(M, "__msan_origin_tls", IRB.getInt32Ty());
|
||||||
GlobalVariable::InitialExecTLSModel);
|
|
||||||
OriginTLS = new GlobalVariable(
|
|
||||||
M, IRB.getInt32Ty(), false, GlobalVariable::ExternalLinkage, nullptr,
|
|
||||||
"__msan_origin_tls", nullptr, GlobalVariable::InitialExecTLSModel);
|
|
||||||
|
|
||||||
for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;
|
for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;
|
||||||
AccessSizeIndex++) {
|
AccessSizeIndex++) {
|
||||||
@ -808,9 +839,7 @@ Value *MemorySanitizer::getKmsanShadowOriginAccessFn(bool isStore, int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Module-level initialization.
|
/// Module-level initialization.
|
||||||
///
|
void MemorySanitizer::initializeModule(Module &M) {
|
||||||
/// inserts a call to __msan_init to the module's constructor list.
|
|
||||||
bool MemorySanitizer::doInitialization(Module &M) {
|
|
||||||
auto &DL = M.getDataLayout();
|
auto &DL = M.getDataLayout();
|
||||||
|
|
||||||
bool ShadowPassed = ClShadowBase.getNumOccurrences() > 0;
|
bool ShadowPassed = ClShadowBase.getNumOccurrences() > 0;
|
||||||
@ -884,27 +913,26 @@ bool MemorySanitizer::doInitialization(Module &M) {
|
|||||||
OriginStoreWeights = MDBuilder(*C).createBranchWeights(1, 1000);
|
OriginStoreWeights = MDBuilder(*C).createBranchWeights(1, 1000);
|
||||||
|
|
||||||
if (!CompileKernel) {
|
if (!CompileKernel) {
|
||||||
std::tie(MsanCtorFunction, std::ignore) =
|
getOrCreateInitFunction(M, kMsanInitName);
|
||||||
createSanitizerCtorAndInitFunctions(M, kMsanModuleCtorName,
|
|
||||||
kMsanInitName,
|
|
||||||
/*InitArgTypes=*/{},
|
|
||||||
/*InitArgs=*/{});
|
|
||||||
if (ClWithComdat) {
|
|
||||||
Comdat *MsanCtorComdat = M.getOrInsertComdat(kMsanModuleCtorName);
|
|
||||||
MsanCtorFunction->setComdat(MsanCtorComdat);
|
|
||||||
appendToGlobalCtors(M, MsanCtorFunction, 0, MsanCtorFunction);
|
|
||||||
} else {
|
|
||||||
appendToGlobalCtors(M, MsanCtorFunction, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TrackOrigins)
|
if (TrackOrigins)
|
||||||
new GlobalVariable(M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
|
M.getOrInsertGlobal("__msan_track_origins", IRB.getInt32Ty(), [&] {
|
||||||
|
return new GlobalVariable(
|
||||||
|
M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
|
||||||
IRB.getInt32(TrackOrigins), "__msan_track_origins");
|
IRB.getInt32(TrackOrigins), "__msan_track_origins");
|
||||||
|
});
|
||||||
|
|
||||||
if (Recover)
|
if (Recover)
|
||||||
new GlobalVariable(M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
|
M.getOrInsertGlobal("__msan_keep_going", IRB.getInt32Ty(), [&] {
|
||||||
|
return new GlobalVariable(M, IRB.getInt32Ty(), true,
|
||||||
|
GlobalValue::WeakODRLinkage,
|
||||||
IRB.getInt32(Recover), "__msan_keep_going");
|
IRB.getInt32(Recover), "__msan_keep_going");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MemorySanitizerLegacyPass::doInitialization(Module &M) {
|
||||||
|
MSan.emplace(M, TrackOrigins, Recover, EnableKmsan);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,8 +1013,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
SmallVector<ShadowOriginAndInsertPoint, 16> InstrumentationList;
|
SmallVector<ShadowOriginAndInsertPoint, 16> InstrumentationList;
|
||||||
SmallVector<StoreInst *, 16> StoreList;
|
SmallVector<StoreInst *, 16> StoreList;
|
||||||
|
|
||||||
MemorySanitizerVisitor(Function &F, MemorySanitizer &MS)
|
MemorySanitizerVisitor(Function &F, MemorySanitizer &MS,
|
||||||
: F(F), MS(MS), VAHelper(CreateVarArgHelper(F, MS, *this)) {
|
const TargetLibraryInfo &TLI)
|
||||||
|
: F(F), MS(MS), VAHelper(CreateVarArgHelper(F, MS, *this)), TLI(&TLI) {
|
||||||
bool SanitizeFunction = F.hasFnAttribute(Attribute::SanitizeMemory);
|
bool SanitizeFunction = F.hasFnAttribute(Attribute::SanitizeMemory);
|
||||||
InsertChecks = SanitizeFunction;
|
InsertChecks = SanitizeFunction;
|
||||||
PropagateShadow = SanitizeFunction;
|
PropagateShadow = SanitizeFunction;
|
||||||
@ -995,7 +1024,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
// FIXME: Consider using SpecialCaseList to specify a list of functions that
|
// FIXME: Consider using SpecialCaseList to specify a list of functions that
|
||||||
// must always return fully initialized values. For now, we hardcode "main".
|
// must always return fully initialized values. For now, we hardcode "main".
|
||||||
CheckReturnValue = SanitizeFunction && (F.getName() == "main");
|
CheckReturnValue = SanitizeFunction && (F.getName() == "main");
|
||||||
TLI = &MS.getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
|
||||||
|
|
||||||
MS.initializeCallbacks(*F.getParent());
|
MS.initializeCallbacks(*F.getParent());
|
||||||
if (MS.CompileKernel)
|
if (MS.CompileKernel)
|
||||||
@ -4430,10 +4458,8 @@ static VarArgHelper *CreateVarArgHelper(Function &Func, MemorySanitizer &Msan,
|
|||||||
return new VarArgNoOpHelper(Func, Msan, Visitor);
|
return new VarArgNoOpHelper(Func, Msan, Visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MemorySanitizer::runOnFunction(Function &F) {
|
bool MemorySanitizer::sanitizeFunction(Function &F, TargetLibraryInfo &TLI) {
|
||||||
if (!CompileKernel && (&F == MsanCtorFunction))
|
MemorySanitizerVisitor Visitor(F, *this, TLI);
|
||||||
return false;
|
|
||||||
MemorySanitizerVisitor Visitor(F, *this);
|
|
||||||
|
|
||||||
// Clear out readonly/readnone attributes.
|
// Clear out readonly/readnone attributes.
|
||||||
AttrBuilder B;
|
AttrBuilder B;
|
||||||
|
@ -174,6 +174,27 @@ std::pair<Function *, Function *> llvm::createSanitizerCtorAndInitFunctions(
|
|||||||
return std::make_pair(Ctor, InitFunction);
|
return std::make_pair(Ctor, InitFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function *llvm::getOrCreateInitFunction(Module &M, StringRef Name) {
|
||||||
|
assert(!Name.empty() && "Expected init function name");
|
||||||
|
if (Function *F = M.getFunction(Name)) {
|
||||||
|
if (F->arg_size() != 0 ||
|
||||||
|
F->getReturnType() != Type::getVoidTy(M.getContext())) {
|
||||||
|
std::string Err;
|
||||||
|
raw_string_ostream Stream(Err);
|
||||||
|
Stream << "Sanitizer interface function defined with wrong type: " << *F;
|
||||||
|
report_fatal_error(Err);
|
||||||
|
}
|
||||||
|
return F;
|
||||||
|
}
|
||||||
|
Function *F = checkSanitizerInterfaceFunction(M.getOrInsertFunction(
|
||||||
|
Name, AttributeList(), Type::getVoidTy(M.getContext())));
|
||||||
|
F->setLinkage(Function::ExternalLinkage);
|
||||||
|
|
||||||
|
appendToGlobalCtors(M, F, 0);
|
||||||
|
|
||||||
|
return F;
|
||||||
|
}
|
||||||
|
|
||||||
void llvm::filterDeadComdatFunctions(
|
void llvm::filterDeadComdatFunctions(
|
||||||
Module &M, SmallVectorImpl<Function *> &DeadComdatFunctions) {
|
Module &M, SmallVectorImpl<Function *> &DeadComdatFunctions) {
|
||||||
// Build a map from the comdat to the number of entries in that comdat we
|
// Build a map from the comdat to the number of entries in that comdat we
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
|
target datalayout = "E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
|
target datalayout = "e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "E-m:e-i64:64-n32:64"
|
target datalayout = "E-m:e-i64:64-n32:64"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-n32:64"
|
target datalayout = "e-m:e-i64:64-n32:64"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S 2>&1 -passes=msan | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S 2>&1 | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S 2>&1 | FileCheck %s
|
||||||
|
|
||||||
; Test that MSan doesn't generate code overflowing __msan_va_arg_tls when too many arguments are
|
; Test that MSan doesn't generate code overflowing __msan_va_arg_tls when too many arguments are
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S
|
||||||
; Test that code using va_start can be compiled on i386.
|
; Test that code using va_start can be compiled on i386.
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CHECK-ORIGIN"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CHECK-ORIGIN"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
|
||||||
|
|
||||||
; Test that shadow and origin are stored for variadic function params.
|
; Test that shadow and origin are stored for variadic function params.
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s "--check-prefixes=CHECK,INLINE"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s --check-prefixes=CHECK,INLINE
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s --check-prefixes=CHECK,INLINE
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-poison-stack-with-call=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CALL"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-poison-stack-with-call=1 -S | FileCheck %s --check-prefixes=CHECK,CALL
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-poison-stack-with-call=1 -S | FileCheck %s --check-prefixes=CHECK,CALL
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,ORIGIN"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,ORIGIN"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -S -passes=msan 2>&1 | FileCheck %s \
|
||||||
|
; RUN: "--check-prefixes=CHECK,KMSAN"
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck %s --check-prefixes=CHECK,KMSAN
|
; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck %s --check-prefixes=CHECK,KMSAN
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
|
||||||
|
; RUN: -check-prefix=CHECK-ORIGINS %s --allow-empty
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
; Test that copy alignment for byval arguments is limited by param-tls slot alignment.
|
; Test that copy alignment for byval arguments is limited by param-tls slot alignment.
|
||||||
|
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-check-constant-shadow=1 \
|
||||||
|
; RUN: -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-check-constant-shadow=1 -msan-track-origins=1 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-check-constant-shadow=1 -msan-track-origins=1 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s --check-prefix=ADDR
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR
|
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
; MSan converts 2-element global_ctors to 3-element when adding the new entry.
|
|
||||||
; RUN: opt < %s -msan -msan-with-comdat -S | FileCheck %s
|
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
|
||||||
|
|
||||||
; CHECK: $msan.module_ctor = comdat any
|
|
||||||
; CHECK: @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }, { i32, void ()*, i8* } { i32 0, void ()* @msan.module_ctor, i8* bitcast (void ()* @msan.module_ctor to i8*) }]
|
|
||||||
|
|
||||||
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }]
|
|
||||||
|
|
||||||
define internal void @f() {
|
|
||||||
entry:
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
||||||
; CHECK: define internal void @msan.module_ctor() comdat {
|
|
@ -2,8 +2,19 @@
|
|||||||
; Test that in with-calls mode there are no calls to __msan_chain_origin - they
|
; Test that in with-calls mode there are no calls to __msan_chain_origin - they
|
||||||
; are done from __msan_maybe_store_origin_*.
|
; are done from __msan_maybe_store_origin_*.
|
||||||
|
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-instrumentation-with-call-threshold=0 -S -passes=msan 2>&1 | \
|
||||||
|
; RUN: FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
|
||||||
|
; RUN: -check-prefix=CHECK-ORIGINS %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
|
||||||
|
; RUN: -check-prefix=CHECK-ORIGINS %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
; Test that the msan layout customization options work as expected
|
; Test that the msan layout customization options work as expected
|
||||||
;
|
;
|
||||||
|
; RUN: opt < %s -msan-shadow-base 3735928559 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: --check-prefix=CHECK-BASE %s
|
||||||
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -S | FileCheck --check-prefix=CHECK-BASE %s
|
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -S | FileCheck --check-prefix=CHECK-BASE %s
|
||||||
|
; RUN: opt < %s -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck --check-prefix=CHECK-AND %s
|
||||||
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-AND %s
|
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-AND %s
|
||||||
|
; RUN: opt < %s -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck --check-prefix=CHECK-XOR %s
|
||||||
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S | FileCheck --check-prefix=CHECK-XOR %s
|
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S | FileCheck --check-prefix=CHECK-XOR %s
|
||||||
|
; RUN: opt < %s -msan-shadow-base 3735928559 -msan-xor-mask 48879 \
|
||||||
|
; RUN: -msan-and-mask 4294901760 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: --check-prefix=CHECK-XOR-AND %s
|
||||||
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-XOR-AND %s
|
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-XOR-AND %s
|
||||||
|
; RUN: opt < %s -msan-track-origins 1 -msan-origin-base 1777777 -S -passes=msan\
|
||||||
|
; RUN: 2>&1 | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s
|
||||||
; RUN: opt < %s -msan -msan-track-origins 1 -msan-origin-base 1777777 -S | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s
|
; RUN: opt < %s -msan -msan-track-origins 1 -msan-origin-base 1777777 -S | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s
|
||||||
|
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CHECK-ORIGIN"
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
|
||||||
|
; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s --check-prefix=ADDR
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR
|
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
; Test for handling of asm constraints in MSan instrumentation.
|
; Test for handling of asm constraints in MSan instrumentation.
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-handle-asm-conservative=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: "-check-prefixes=CHECK,CHECK-NONCONS" %s
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
|
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-handle-asm-conservative=1 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: "-check-prefixes=CHECK,CHECK-CONS" %s
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=1 -S | FileCheck -check-prefixes=CHECK,CHECK-CONS %s
|
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=1 -S | FileCheck -check-prefixes=CHECK,CHECK-CONS %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: -allow-deprecated-dag-overlap %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck -allow-deprecated-dag-overlap %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck -allow-deprecated-dag-overlap %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -allow-deprecated-dag-overlap \
|
||||||
|
; RUN: -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -allow-deprecated-dag-overlap -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -allow-deprecated-dag-overlap -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
; CHECK: @llvm.global_ctors {{.*}} { i32 0, void ()* @msan.module_ctor, i8* null }
|
; CHECK: @llvm.global_ctors {{.*}} { i32 0, void ()* @__msan_init, i8* null }
|
||||||
|
|
||||||
; Check the presence and the linkage type of __msan_track_origins and
|
; Check the presence and the linkage type of __msan_track_origins and
|
||||||
; other interface symbols.
|
; other interface symbols.
|
||||||
@ -986,5 +991,4 @@ define i8* @MismatchingCallMustTailCall(i32 %a) sanitize_memory {
|
|||||||
; CHECK-NEXT: ret i8*
|
; CHECK-NEXT: ret i8*
|
||||||
|
|
||||||
|
|
||||||
; CHECK-LABEL: define internal void @msan.module_ctor() {
|
; CHECK: declare void @__msan_init()
|
||||||
; CHECK: call void @__msan_init()
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
; KMSAN instrumentation tests
|
; KMSAN instrumentation tests
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -S -passes=msan 2>&1 | FileCheck %s \
|
||||||
|
; RUN: -check-prefixes=CHECK
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck %s -check-prefixes=CHECK
|
; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck %s -check-prefixes=CHECK
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
; Test for the conservative assembly handling mode used by KMSAN.
|
; Test for the conservative assembly handling mode used by KMSAN.
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-handle-asm-conservative=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: "-check-prefixes=CHECK,CHECK-NONCONS" %s
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
|
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
|
||||||
|
; RUN: -msan-handle-asm-conservative=1 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: "-check-prefixes=CHECK,CHECK-CONS" %s
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=1 -S | FileCheck -check-prefixes=CHECK,CHECK-CONS %s
|
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=1 -S | FileCheck -check-prefixes=CHECK,CHECK-CONS %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
|
||||||
|
; RUN: -check-prefix=CHECK-ORIGINS %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
; Verify that calls with !nosanitize are not instrumented by MSan.
|
; Verify that calls with !nosanitize are not instrumented by MSan.
|
||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
|
; RUN: opt < %s -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-track-origins=1 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-track-origins=1 -S | FileCheck %s
|
||||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
|
||||||
|
; RUN: -check-prefix=CHECK-ORIGINS1 %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS1 %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS1 %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
|
||||||
|
; RUN: -check-prefix=CHECK-ORIGINS2 %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS2 %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS2 %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
; Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842
|
; Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842
|
||||||
;
|
;
|
||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
;target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
;target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: "-check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS1" %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS1 %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS1 %s
|
||||||
|
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
|
||||||
|
; RUN: -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: "-check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS2" %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck -check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS2 %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck -check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS2 %s
|
||||||
|
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 -S -passes=msan \
|
||||||
|
; RUN: 2>&1 | FileCheck "-check-prefixes=CHECK,CHECK-KMSAN,CHECK-ORIGINS2" %s
|
||||||
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -S | FileCheck -check-prefixes=CHECK,CHECK-KMSAN,CHECK-ORIGINS2 %s
|
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -S | FileCheck -check-prefixes=CHECK,CHECK-KMSAN,CHECK-ORIGINS2 %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
; Test marking string functions as nobuiltin in memory sanitizer.
|
; Test marking string functions as nobuiltin in memory sanitizer.
|
||||||
;
|
;
|
||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S | FileCheck %s
|
; RUN: opt < %s -msan -S | FileCheck %s
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
; Check that unsized token types used by coroutine intrinsics do not cause
|
; Check that unsized token types used by coroutine intrinsics do not cause
|
||||||
; assertion failures.
|
; assertion failures.
|
||||||
|
; RUN: opt < %s -S 2>&1 -passes=msan | FileCheck %s
|
||||||
; RUN: opt < %s -msan -S 2>&1 | FileCheck %s
|
; RUN: opt < %s -msan -S 2>&1 | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
||||||
|
; RUN: %s
|
||||||
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
||||||
; REQUIRES: x86-registered-target
|
; REQUIRES: x86-registered-target
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
; RUN: opt < %s -msan-instrumentation-with-call-threshold=0 -S -passes=msan \
|
||||||
|
; RUN: 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -msan -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
|
; RUN: opt < %s -msan -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
|
||||||
|
|
||||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||||
|
Loading…
Reference in New Issue
Block a user