summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-07-07 01:31:23 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-07-07 01:31:23 +0000
commit7d3eeaaa960d3824983ae664bfa5ad75c5bd1f57 (patch)
tree2023335b3048c2d7e6754b6d5aaab157a85a82b6 /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
parent7a493393b360bbbc3d4c050ba1149faaf53b7ac4 (diff)
downloadbcm5719-llvm-7d3eeaaa960d3824983ae664bfa5ad75c5bd1f57.tar.gz
bcm5719-llvm-7d3eeaaa960d3824983ae664bfa5ad75c5bd1f57.zip
Revert r307342, r307343.
Revert "Copy arguments passed by value into explicit allocas for ASan." Revert "[asan] Add end-to-end tests for overflows of byval arguments." Build failure on lldb-x86_64-ubuntu-14.04-buildserver. Test failure on clang-cmake-aarch64-42vma and sanitizer-x86_64-linux-android. llvm-svn: 307345
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp37
1 files changed, 0 insertions, 37 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 5f98cd566f3..184940b7ea5 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -22,11 +22,9 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
-#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
-#include "llvm/IR/Argument.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DataLayout.h"
@@ -194,11 +192,6 @@ static cl::opt<uint32_t> ClMaxInlinePoisoningSize(
static cl::opt<bool> ClUseAfterReturn("asan-use-after-return",
cl::desc("Check stack-use-after-return"),
cl::Hidden, cl::init(true));
-static cl::opt<bool> ClRedzoneByvalArgs("asan-redzone-byval-args",
- cl::desc("Create redzones for byval "
- "arguments (extra copy "
- "required)"), cl::Hidden,
- cl::init(true));
static cl::opt<bool> ClUseAfterScope("asan-use-after-scope",
cl::desc("Check stack-use-after-scope"),
cl::Hidden, cl::init(false));
@@ -754,9 +747,6 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> {
bool runOnFunction() {
if (!ClStack) return false;
-
- if (ClRedzoneByvalArgs) copyArgsPassedByValToAllocas();
-
// Collect alloca, ret, lifetime instructions etc.
for (BasicBlock *BB : depth_first(&F.getEntryBlock())) visit(*BB);
@@ -773,11 +763,6 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> {
return true;
}
- // Arguments marked with the "byval" attribute are implicitly copied without
- // using an alloca instruction. To produce redzones for those arguments, we
- // copy them a second time into memory allocated with an alloca instruction.
- void copyArgsPassedByValToAllocas();
-
// Finds all Alloca instructions and puts
// poisoned red zones around all of them.
// Then unpoison everything back before the function returns.
@@ -2543,28 +2528,6 @@ static int StackMallocSizeClass(uint64_t LocalStackSize) {
llvm_unreachable("impossible LocalStackSize");
}
-void FunctionStackPoisoner::copyArgsPassedByValToAllocas() {
- BasicBlock &FirstBB = *F.begin();
- IRBuilder<> IRB(&FirstBB, FirstBB.getFirstInsertionPt());
- const DataLayout &DL = F.getParent()->getDataLayout();
- for (Argument &Arg : F.args()) {
- if (Arg.hasByValAttr()) {
- Type *Ty = Arg.getType()->getPointerElementType();
- unsigned Align = Arg.getParamAlignment();
- if (Align == 0) Align = DL.getABITypeAlignment(Ty);
-
- const std::string &Name = Arg.hasName() ? Arg.getName().str() :
- "Arg" + std::to_string(Arg.getArgNo());
- AllocaInst *AI = IRB.CreateAlloca(Ty, nullptr, Twine(Name) + ".byval");
- AI->setAlignment(Align);
- Arg.replaceAllUsesWith(AI);
-
- uint64_t AllocSize = DL.getTypeAllocSize(Ty);
- IRB.CreateMemCpy(AI, &Arg, AllocSize, Align);
- }
- }
-}
-
PHINode *FunctionStackPoisoner::createPHI(IRBuilder<> &IRB, Value *Cond,
Value *ValueIfTrue,
Instruction *ThenTerm,
OpenPOWER on IntegriCloud