From a5ef93c83a958b5df1ee1c602c687122648aadb6 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 22 May 2020 11:42:04 +0200 Subject: fix cmplog for llvm 11-dev --- llvm_mode/cmplog-routines-pass.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'llvm_mode/cmplog-routines-pass.cc') diff --git a/llvm_mode/cmplog-routines-pass.cc b/llvm_mode/cmplog-routines-pass.cc index bb78273a..623388ba 100644 --- a/llvm_mode/cmplog-routines-pass.cc +++ b/llvm_mode/cmplog-routines-pass.cc @@ -93,16 +93,17 @@ bool CmpLogRoutines::hookRtns(Module &M) { std::vector calls; LLVMContext & C = M.getContext(); - Type * VoidTy = Type::getVoidTy(C); - PointerType *VoidPtrTy = PointerType::get(VoidTy, 0); + Type *VoidTy = Type::getVoidTy(C); + // PointerType *VoidPtrTy = PointerType::get(VoidTy, 0); + IntegerType *Int8Ty = IntegerType::getInt8Ty(C); + PointerType *i8PtrTy = PointerType::get(Int8Ty, 0); #if LLVM_VERSION_MAJOR < 9 Constant * #else FunctionCallee #endif - c = M.getOrInsertFunction("__cmplog_rtn_hook", VoidTy, VoidPtrTy, - VoidPtrTy + c = M.getOrInsertFunction("__cmplog_rtn_hook", VoidTy, i8PtrTy, i8PtrTy #if LLVM_VERSION_MAJOR < 5 , NULL -- cgit 1.4.1 From fc574086ec8beff72a032f73884fb9f1f0d02f47 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 24 May 2020 15:15:17 +0200 Subject: fix cmplog --- docs/Changelog.md | 3 ++- llvm_mode/cmplog-routines-pass.cc | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'llvm_mode/cmplog-routines-pass.cc') diff --git a/docs/Changelog.md b/docs/Changelog.md index 4b6e90e5..6115a0cc 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -28,7 +28,8 @@ sending a mail to . - LTO whitelist functionality rewritten, now main, _init etc functions need not to be whitelisted anymore - fixed crash in compare-transform-pass when strcasemp/strncasecmp was - tried to be instrumented + tried to be instrumented with LTO + - fixed crash in cmplog with LTO - fixed afl-gcc/afl-as that could break on fast systems reusing pids in the same second - added lots of dictionaries from oss-fuzz, go-fuzz and Jakub Wilk diff --git a/llvm_mode/cmplog-routines-pass.cc b/llvm_mode/cmplog-routines-pass.cc index 623388ba..e05a1843 100644 --- a/llvm_mode/cmplog-routines-pass.cc +++ b/llvm_mode/cmplog-routines-pass.cc @@ -164,8 +164,10 @@ bool CmpLogRoutines::hookRtns(Module &M) { IRB.SetInsertPoint(callInst); std::vector args; - args.push_back(v1P); - args.push_back(v2P); + Value * v1Pcasted = IRB.CreatePointerCast(v1P, i8PtrTy); + Value * v2Pcasted = IRB.CreatePointerCast(v2P, i8PtrTy); + args.push_back(v1Pcasted); + args.push_back(v2Pcasted); IRB.CreateCall(cmplogHookFn, args, "tmp"); -- cgit 1.4.1