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

Unified Diff: src/IceASanInstrumentation.cpp

Issue 2128383002: Blacklisted instrumenting _Balloc. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 5 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') | src/IceInstrumentation.h » ('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 a7551a8961aaa28ece76fda768baaa9055973311..69e877e22f1544cc4c47bb7f16569ddf4730ca77 100644
--- a/src/IceASanInstrumentation.cpp
+++ b/src/IceASanInstrumentation.cpp
@@ -24,6 +24,7 @@
#include <sstream>
#include <unordered_map>
+#include <unordered_set>
#include <vector>
namespace Ice {
@@ -37,12 +38,14 @@ constexpr const char *RzSizesName = "__$rz_sizes";
const llvm::NaClBitcodeRecord::RecordVector RzContents =
llvm::NaClBitcodeRecord::RecordVector(RzSize, 'R');
-// TODO(tlively): Handle all allocation functions
// In order to instrument the code correctly, the .pexe must not have had its
// symbols stripped.
using string_map = std::unordered_map<std::string, std::string>;
+using string_set = std::unordered_set<std::string>;
+// TODO(tlively): Handle all allocation functions
const string_map FuncSubstitutions = {{"malloc", "__asan_malloc"},
{"free", "__asan_free"}};
+const string_set FuncBlackList = {"_Balloc"};
llvm::NaClBitcodeRecord::RecordVector sizeToByteVec(SizeT Size) {
llvm::NaClBitcodeRecord::RecordVector SizeContents;
@@ -58,6 +61,11 @@ llvm::NaClBitcodeRecord::RecordVector sizeToByteVec(SizeT Size) {
ICE_TLS_DEFINE_FIELD(std::vector<InstCall *> *, ASanInstrumentation,
LocalDtors);
+bool ASanInstrumentation::isInstrumentable(Cfg *Func) {
+ std::string FuncName = Func->getFunctionName().toStringOrEmpty();
+ return FuncName == "" || FuncBlackList.find(FuncName) == FuncBlackList.end();
Karl 2016/07/07 21:20:49 Actually, a simpler test is: || FuncBlackList
tlively 2016/07/08 16:56:21 Done.
+}
+
// Create redzones around all global variables, ensuring that the initializer
// types of the redzones and their associated globals match so that they are
// laid out together in memory.
@@ -333,8 +341,7 @@ void ASanInstrumentation::instrumentStart(Cfg *Func) {
}
// TODO(tlively): make this more efficient with swap idiom
-void ASanInstrumentation::finishFunc(Cfg *Func) {
- (void)Func;
+void ASanInstrumentation::finishFunc(Cfg *) {
ICE_TLS_GET_FIELD(LocalDtors)->clear();
}
« no previous file with comments | « src/IceASanInstrumentation.h ('k') | src/IceInstrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698