Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AFLGO_TRACING error #16

Closed
lvtao-sec opened this issue Mar 17, 2018 · 3 comments
Closed

AFLGO_TRACING error #16

lvtao-sec opened this issue Mar 17, 2018 · 3 comments

Comments

@lvtao-sec
Copy link

Hi, if I define AFLGO_TRACING in afl-llvm-pass.so.cc file, there is always an error as follows when i using afl-clang-fast to compiler libtiff-4.0.7.

/home/lt/aflgo-org/afl-clang-fast
lt@e7c1d8be0a16:/libtiff/tiff-4.0.7-save-temp/aflgo-build$ ls
lt@e7c1d8be0a16:
/libtiff/tiff-4.0.7-save-temp/aflgo-build$ cmake ..
-- Building tiff version 4.0.7
-- libtiff library version 5.2.5
-- The C compiler identification is unknown
-- Check for working C compiler: /home/lt/aflgo-org/afl-clang-fast
-- Check for working C compiler: /home/lt/aflgo-org/afl-clang-fast -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/home/lt/aflgo-org/afl-clang-fast" is not able to compile a
simple test program.

It fails with the following output:

Change Dir: /home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_695f0/fast"

/usr/bin/make -f CMakeFiles/cmTC_695f0.dir/build.make
CMakeFiles/cmTC_695f0.dir/build

make[1]: Entering directory
'/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_695f0.dir/testCCompiler.c.o

/home/lt/aflgo-org/afl-clang-fast
-targets=/home/lt/libtiff/tiff-4.0.7-save-temp/temp/BBtargets.txt
-outdir=/home/lt/libtiff/tiff-4.0.7-save-temp/temp -flto -fuse-ld=gold
-Wl,-plugin-opt=save-temps -lz -ljbig -lm -o
CMakeFiles/cmTC_695f0.dir/testCCompiler.c.o -c
/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp/testCCompiler.c

#0 0x0000000001474d8a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/bin/clang-7.0+0x1474d8a)

#1 0x0000000001472e6e llvm::sys::RunSignalHandlers()
(/usr/local/bin/clang-7.0+0x1472e6e)

#2 0x0000000001472fbc SignalHandler(int)
(/usr/local/bin/clang-7.0+0x1472fbc)

#3 0x00007f9fabede390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)

#4 0x0000000000f8e8cf llvm::ConstantExpr::getGetElementPtr(llvm::Type*,
llvm::Constant*, llvm::ArrayRefllvm::Value*, bool,
llvm::Optional, llvm::Type*)
(/usr/local/bin/clang-7.0+0xf8e8cf)

#5 0x00007f9faae583be
llvm::ConstantExpr::getInBoundsGetElementPtr(llvm::Type*, llvm::Constant*,
llvm::ArrayRefllvm::Value*)
/usr/local/include/llvm/IR/Constants.h:1160:12

#6 0x00007f9faae583be
llvm::ConstantFolder::CreateInBoundsGetElementPtr(llvm::Type*,
llvm::Constant*, llvm::ArrayRefllvm::Value*) const
/usr/local/include/llvm/IR/ConstantFolder.h:174:0

#7 0x00007f9faae583be llvm::IRBuilder<llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter>::CreateInBoundsGEP(llvm::Type*,
llvm::Value*, llvm::ArrayRefllvm::Value*, llvm::Twine const&)
/usr/local/include/llvm/IR/IRBuilder.h:1335:0

#8 0x00007f9faae583be llvm::IRBuilder<llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter>::CreateGlobalStringPtr(llvm::StringRef,
llvm::Twine const&, unsigned int)
/usr/local/include/llvm/IR/IRBuilder.h:1455:0

#9 0x00007f9faae583be (anonymous
namespace)::AFLCoverage::runOnModule(llvm::Module&)
/home/lt/aflgo-org/llvm_mode/afl-llvm-pass.so.cc:376:0

#10 0x0000000001009d14 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/bin/clang-7.0+0x1009d14)

#11 0x0000000001643251 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_deletellvm::raw_pwrite_stream >)
(/usr/local/bin/clang-7.0+0x1643251)

#12 0x0000000001645362 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_deletellvm::raw_pwrite_stream >)
(/usr/local/bin/clang-7.0+0x1645362)

#13 0x0000000001d4dc44
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/bin/clang-7.0+0x1d4dc44)

#14 0x0000000002541240 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/bin/clang-7.0+0x2541240)

#15 0x0000000001d4d227 clang::CodeGenAction::ExecuteAction()
(/usr/local/bin/clang-7.0+0x1d4d227)

#16 0x0000000001a0c17e clang::FrontendAction::Execute()
(/usr/local/bin/clang-7.0+0x1a0c17e)

#17 0x00000000019d7996
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/bin/clang-7.0+0x19d7996)

#18 0x0000000001a9f87c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/bin/clang-7.0+0x1a9f87c)

#19 0x00000000008a41b8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/bin/clang-7.0+0x8a41b8)

#20 0x000000000084fe97 main (/usr/local/bin/clang-7.0+0x84fe97)

#21 0x00007f9fab07e830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)

#22 0x00000000008a18e9 _start (/usr/local/bin/clang-7.0+0x8a18e9)

Stack dump:

  1. Program arguments: /usr/local/bin/clang-7.0 -cc1 -triple
    x86_64-unknown-linux-gnu -emit-llvm-bc -flto -flto-unit -disable-free
    -disable-llvm-verifier -discard-value-names -main-file-name testCCompiler.c
    -mrelocation-model static -mthread-model posix
    -fno-escaping-block-tail-calls -fmath-errno -masm-verbose
    -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
    -dwarf-column-info -debug-info-kind=limited -dwarf-version=4
    -debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file
    /home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_695f0.dir/testCCompiler.c.gcno
    -resource-dir /usr/local/lib/clang/7.0.0 -D __AFL_HAVE_MANUAL_CONTROL=1 -D
    __AFL_COMPILER=1 -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -D
    __AFL_LOOP(_A)=({ static volatile char _B attribute((used)); _B =
    (char
    )"##SIG_AFL_PERSISTENT##"; attribute((visibility("default"))) int
    _L(unsigned int) asm("__afl_persistent_loop"); _L(_A); }) -D
    __AFL_INIT()=do { static volatile char _A attribute((used)); _A =
    (char
    )"##SIG_AFL_DEFER_FORKSRV##"; attribute((visibility("default")))
    void _I(void) asm("__afl_manual_init"); _I(); } while (0)
    -internal-isystem /usr/local/include -internal-isystem
    /usr/local/lib/clang/7.0.0/include -internal-externc-isystem
    /usr/include/x86_64-linux-gnu -internal-externc-isystem /include
    -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
    /home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp
    -ferror-limit 19 -fmessage-length 0 -funroll-loops -fobjc-runtime=gcc
    -fdiagnostics-show-option -vectorize-loops -vectorize-slp -load
    /home/lt/aflgo-org/afl-llvm-pass.so -mllvm
    -targets=/home/lt/libtiff/tiff-4.0.7-save-temp/temp/BBtargets.txt -mllvm
    -outdir=/home/lt/libtiff/tiff-4.0.7-save-temp/temp -o
    CMakeFiles/cmTC_695f0.dir/testCCompiler.c.o -x c
    /home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp/testCCompiler.c

  2. parser at end of file

  3. Per-module optimization passes

  4. Running pass 'Unnamed pass: implement Pass::getPassName()' on module
    '/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp/testCCompiler.c'.

clang-7.0: error: unable to execute command: Segmentation fault (core
dumped)

clang-7.0: error: clang frontend command failed due to signal (use -v to
see invocation)

clang version 7.0.0 (http://llvm.org/git/clang.git
4890a84991653f96f89aaad7e8215afdba8b0441) (http://llvm.org/git/llvm.git
92758f37a54d542b201d1b48724e5c0da9290419)

Target: x86_64-unknown-linux-gnu

Thread model: posix

InstalledDir: /usr/local/bin

clang-7.0: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed
source, and associated run script.

clang-7.0: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:

Preprocessed source(s) and associated run script(s) are located at:

clang-7.0: note: diagnostic msg: /tmp/testCCompiler-5b1bda.c

clang-7.0: note: diagnostic msg: /tmp/testCCompiler-5b1bda.sh

clang-7.0: note: diagnostic msg:


CMakeFiles/cmTC_695f0.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_695f0.dir/testCCompiler.c.o' failed

make[1]: *** [CMakeFiles/cmTC_695f0.dir/testCCompiler.c.o] Error 254

make[1]: Leaving directory
'/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp'

Makefile:126: recipe for target 'cmTC_695f0/fast' failed

make: *** [cmTC_695f0/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:71 (project)

-- Configuring incomplete, errors occurred!
See also "/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeOutput.log".
See also "/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeError.log".

@lvtao-sec
Copy link
Author

I changed the createglobalstrptr to GlobalVariable, but a new error comes as follows. I'm using llvm 7.0. I want to know what version of llvm you used.

-- Building tiff version 4.0.7
-- libtiff library version 5.2.5
-- The C compiler identification is unknown
-- Check for working C compiler: /home/lt/aflgo-org/afl-clang-fast
-- Check for working C compiler: /home/lt/aflgo-org/afl-clang-fast -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/home/lt/aflgo-org/afl-clang-fast" is not able to compile a
simple test program.

It fails with the following output:

Change Dir: /home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_04bdf/fast"

/usr/bin/make -f CMakeFiles/cmTC_04bdf.dir/build.make
CMakeFiles/cmTC_04bdf.dir/build

make[1]: Entering directory
'/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_04bdf.dir/testCCompiler.c.o

/home/lt/aflgo-org/afl-clang-fast
-targets=/home/lt/libtiff/tiff-4.0.7-save-temp/temp/BBtargets.txt
-outdir=/home/lt/libtiff/tiff-4.0.7-save-temp/temp -flto -fuse-ld=gold
-Wl,-plugin-opt=save-temps -lz -ljbig -lm -o
CMakeFiles/cmTC_04bdf.dir/testCCompiler.c.o -c
/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp/testCCompiler.c

Linking C executable cmTC_04bdf

/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_04bdf.dir/link.txt
--verbose=1

/home/lt/aflgo-org/afl-clang-fast
-targets=/home/lt/libtiff/tiff-4.0.7-save-temp/temp/BBtargets.txt
-outdir=/home/lt/libtiff/tiff-4.0.7-save-temp/temp -flto -fuse-ld=gold
-Wl,-plugin-opt=save-temps -lz -ljbig -lm
CMakeFiles/cmTC_04bdf.dir/testCCompiler.c.o -o cmTC_04bdf

/usr/bin/ld.gold: fatal error: Failed to link module
CMakeFiles/cmTC_04bdf.dir/testCCompiler.c.o: Invalid record (Producer:
'LLVM7.0.0svn' Reader: 'LLVM 7.0.0svn')

clang-7.0: error: linker command failed with exit code 1 (use -v to see
invocation)

CMakeFiles/cmTC_04bdf.dir/build.make:97: recipe for target 'cmTC_04bdf'
failed

make[1]: *** [cmTC_04bdf] Error 1

make[1]: Leaving directory
'/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeTmp'

Makefile:126: recipe for target 'cmTC_04bdf/fast' failed

make: *** [cmTC_04bdf/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:71 (project)

-- Configuring incomplete, errors occurred!
See also "/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeOutput.log".
See also "/home/lt/libtiff/tiff-4.0.7-save-temp/aflgo-build/CMakeFiles/CMakeError.log".

@thuanpv
Copy link
Collaborator

thuanpv commented Mar 24, 2018

hi @levi-2018
Look at your error message, I see that you are using LLVM 7.0. Can you please try to use LLVM 3.8 or LLVM 4.0?

There could be some LLVM-version specific issue that we have not encountered. We tested our tool mostly with LLVM 3.8 and LLVM 4.0.

@lvtao-sec
Copy link
Author

Ok, I'll try it with LLVM 4.0. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants