google / AFL

american fuzzy lop - a security-oriented fuzzer
https://lcamtuf.coredump.cx/afl/
Apache License 2.0
3.56k stars 625 forks source link

llvm_mode doesn't seem to support Clang 13 #156

Open yonic2 opened 2 years ago

yonic2 commented 2 years ago

When running make -C llvm_mode, it generates some deprecation warnings and fails the test:

$ clang --version
Debian clang version 13.0.1-3
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ make -C llvm_mode

[*] Checking for working 'llvm-config'...
[*] Checking for working 'clang'...
[*] Checking for '../afl-showmap'...
[+] All set and ready to build.
clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DVERSION=\"2.54b\"  afl-clang-fast.c -o ../afl-clang-fast
ln -sf afl-clang-fast ../afl-clang-fast++
clang++ `llvm-config --cxxflags` -Wl,-znodelete -fno-rtti -fpic -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DVERSION=\"2.54b\" -Wno-variadic-macros -shared afl-llvm-pass.so.cc -o ../afl-llvm-pass.so `llvm-config --ldflags`
afl-llvm-pass.so.cc:134:31: warning: 'CreateLoad' is deprecated: Use the version that explicitly specifies the loaded type instead [-Wdeprecated-declarations]
      LoadInst *PrevLoc = IRB.CreateLoad(AFLPrevLoc);
                              ^
/usr/lib/llvm-13/include/llvm/IR/IRBuilder.h:1678:3: note: 'CreateLoad' has been explicitly marked deprecated here
  LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr,
  ^
/usr/lib/llvm-13/include/llvm/Support/Compiler.h:320:52: note: expanded from macro 'LLVM_ATTRIBUTE_DEPRECATED'
#define LLVM_ATTRIBUTE_DEPRECATED(decl, message) [[deprecated(message)]] decl
                                                   ^
afl-llvm-pass.so.cc:140:30: warning: 'CreateLoad' is deprecated: Use the version that explicitly specifies the loaded type instead [-Wdeprecated-declarations]
      LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr);
                             ^
/usr/lib/llvm-13/include/llvm/IR/IRBuilder.h:1678:3: note: 'CreateLoad' has been explicitly marked deprecated here
  LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr,
  ^
/usr/lib/llvm-13/include/llvm/Support/Compiler.h:320:52: note: expanded from macro 'LLVM_ATTRIBUTE_DEPRECATED'
#define LLVM_ATTRIBUTE_DEPRECATED(decl, message) [[deprecated(message)]] decl
                                                   ^
afl-llvm-pass.so.cc:143:15: warning: 'CreateGEP' is deprecated: Use the version with explicit element type instead [-Wdeprecated-declarations]
          IRB.CreateGEP(MapPtr, IRB.CreateXor(PrevLocCasted, CurLoc));
              ^
/usr/lib/llvm-13/include/llvm/IR/IRBuilder.h:1787:3: note: 'CreateGEP' has been explicitly marked deprecated here
  LLVM_ATTRIBUTE_DEPRECATED(
  ^
/usr/lib/llvm-13/include/llvm/Support/Compiler.h:320:52: note: expanded from macro 'LLVM_ATTRIBUTE_DEPRECATED'
#define LLVM_ATTRIBUTE_DEPRECATED(decl, message) [[deprecated(message)]] decl
                                                   ^
afl-llvm-pass.so.cc:147:31: warning: 'CreateLoad' is deprecated: Use the version that explicitly specifies the loaded type instead [-Wdeprecated-declarations]
      LoadInst *Counter = IRB.CreateLoad(MapPtrIdx);
                              ^
/usr/lib/llvm-13/include/llvm/IR/IRBuilder.h:1678:3: note: 'CreateLoad' has been explicitly marked deprecated here
  LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr,
  ^
/usr/lib/llvm-13/include/llvm/Support/Compiler.h:320:52: note: expanded from macro 'LLVM_ATTRIBUTE_DEPRECATED'
#define LLVM_ATTRIBUTE_DEPRECATED(decl, message) [[deprecated(message)]] decl
                                                   ^
4 warnings generated.
clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DVERSION=\"2.54b\"  -fPIC -c afl-llvm-rt.o.c -o ../afl-llvm-rt.o
[*] Building 32-bit variant of the runtime (-m32)... success!
[*] Building 64-bit variant of the runtime (-m64)... success!
[*] Testing the CC wrapper and instrumentation output...
unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; AFL_QUIET=1 AFL_PATH=. AFL_CC=clang ../afl-clang-fast -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DVERSION=\"2.54b\"  ../test-instr.c -o test-instr
../afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
echo 1 | ../afl-showmap -m none -q -o .test-instr1 ./test-instr

Oops, the instrumentation does not seem to be behaving correctly!

Please ping <lcamtuf@google.com> to troubleshoot the issue.

make: *** [Makefile:103: test_build] Error 1
jonathanmetzman commented 2 years ago

I'd probably just use AFL++ instead.