Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: src/IceASanInstrumentation.cpp

Issue 2115693002: Implemented loose checking for potential widened loads (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Added FileCheck for wide load test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceASanInstrumentation.h ('k') | tests_lit/asan_tests/errors.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceASanInstrumentation.cpp
diff --git a/src/IceASanInstrumentation.cpp b/src/IceASanInstrumentation.cpp
index 8b54fba6b65696f889eb1ff89cb52d80b1bdcf50..bc519bfe59197dfd0c0dbb6fc09fb66bd269b8e4 100644
--- a/src/IceASanInstrumentation.cpp
+++ b/src/IceASanInstrumentation.cpp
@@ -261,26 +261,29 @@ void ASanInstrumentation::instrumentCall(LoweringContext &Context,
void ASanInstrumentation::instrumentLoad(LoweringContext &Context,
InstLoad *Instr) {
+ Constant *Func =
+ Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_check_load"));
instrumentAccess(Context, Instr->getSourceAddress(),
- typeWidthInBytes(Instr->getDest()->getType()));
+ typeWidthInBytes(Instr->getDest()->getType()), Func);
}
void ASanInstrumentation::instrumentStore(LoweringContext &Context,
InstStore *Instr) {
+ Constant *Func =
+ Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_check_store"));
instrumentAccess(Context, Instr->getAddr(),
- typeWidthInBytes(Instr->getData()->getType()));
+ typeWidthInBytes(Instr->getData()->getType()), Func);
}
// TODO(tlively): Take size of access into account as well
void ASanInstrumentation::instrumentAccess(LoweringContext &Context,
- Operand *Op, SizeT Size) {
- Constant *AccessCheck =
- Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_check"));
+ Operand *Op, SizeT Size,
+ Constant *CheckFunc) {
constexpr SizeT NumArgs = 2;
constexpr Variable *Void = nullptr;
constexpr bool NoTailCall = false;
auto *Call = InstCall::create(Context.getNode()->getCfg(), NumArgs, Void,
- AccessCheck, NoTailCall);
+ CheckFunc, NoTailCall);
Call->addArg(Op);
Call->addArg(ConstantInteger32::create(Ctx, IceType_i32, Size));
// play games to insert the call before the access instruction
« no previous file with comments | « src/IceASanInstrumentation.h ('k') | tests_lit/asan_tests/errors.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698