eurecom-s3 / symcc

SymCC: efficient compiler-based symbolic execution
http://www.s3.eurecom.fr/tools/symbolic_execution/symcc.html
GNU General Public License v3.0
773 stars 135 forks source link

A issue about sym++ #63

Closed dhbbb closed 3 years ago

dhbbb commented 3 years ago

Hello,symcc team I try to combine symcc and afl by symcc_fuzzing_helper,When I use symcc to compile the C project, there is no problem.However, the following problems will occur when compiling C++ projects.

-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /home/dh/symcc_build_qsym/sym++
-- Check for working CXX compiler: /home/dh/symcc_build_qsym/sym++ -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:53 (message):
  The C++ compiler

    "/home/dh/symcc_build_qsym/sym++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/.../exiv2-0.27.4/exiv2-0.27.4/build-symcc-test/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_364f3/fast && /usr/bin/make -f CMakeFiles/cmTC_364f3.dir/build.make CMakeFiles/cmTC_364f3.dir/build
    make[1]: Entering directory '/home/.../exiv2-0.27.4/exiv2-0.27.4/build-symcc-test/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_364f3.dir/testCXXCompiler.cxx.o
    /home/dh/symcc_build_qsym/sym++     -o CMakeFiles/cmTC_364f3.dir/testCXXCompiler.cxx.o -c /home/.../exiv2-0.27.4/exiv2-0.27.4/build-symcc-test/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Please set SYMCC_LIBCXX_PATH to the directory containing libc++ or confirm usage of the system library by setting SYMCC_REGULAR_LIBCXX!
    make[1]: *** [CMakeFiles/cmTC_364f3.dir/build.make:66: CMakeFiles/cmTC_364f3.dir/testCXXCompiler.cxx.o] Error 255
    make[1]: Leaving directory '/home/.../exiv2-0.27.4/exiv2-0.27.4/build-symcc-test/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_364f3/fast] Error 2

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

-- Configuring incomplete, errors occurred!

I try to fix it with SYMCC_REGULAR_LIBCXX=1 set in the environment,it worked.But when the program compiled by sym++ is run with afl, the output is all like this

2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Generated 0 test cases (0 new)
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] The target process was killed (probably timeout or out of memory); archiving to out/symcc/hangs
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Running on input out/fuzz2/queue/id:000077,src:000021,time:15399,op:havoc,rep:2,+cov
[2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Generated 0 test cases (0 new)
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] The target process was killed (probably timeout or out of memory); archiving to out/symcc/hangs
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Running on input out/fuzz2/queue/id:000050,src:000021,time:340,op:havoc,rep:8,+cov
[2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Generated 0 test cases (0 new)
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] The target process was killed (probably timeout or out of memory); archiving to out/symcc/hangs
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Running on input out/fuzz2/queue/id:000058,src:000021,time:1328,op:havoc,rep:4,+cov
[2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Generated 0 test cases (0 new)
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] The target process was killed (probably timeout or out of memory); archiving to out/symcc/hangs
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Running on input out/fuzz2/queue/id:000055,src:000021,time:904,op:havoc,rep:4,+cov
[2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Generated 0 test cases (0 new)
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] The target process was killed (probably timeout or out of memory); archiving to out/symcc/hangs
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Running on input out/fuzz2/queue/id:000069,src:000021,time:5273,op:havoc,rep:4,+cov
[2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Generated 0 test cases (0 new)
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] The target process was killed (probably timeout or out of memory); archiving to out/symcc/hangs
[2021-07-08T08:51:39Z INFO  symcc_fuzzing_helper] Running on input out/fuzz2/queue/id:000065,src:000021,time:3927,op:havoc,rep:8,+cov
[2021-07-08T08:51:39Z WARN  symcc_fuzzing_helper::symcc] SymCC received signal 11

Projects complied with symcc(c compiler) can correctly generate test cases, so i think there must be something wrong with it.Could you tell me how to fix it?

dhbbb commented 3 years ago

System info: Ubuntu 20.04.1 : clang 10.0.0 , gcc 9.3.0

aurelf commented 3 years ago

Hi,

did you read this C++.txt ? I'm not sure SYMCC_REGULAR_LIBCXX=1 is equivalent to SYMCC_REGULAR_LIBCXX=yes. Did you try the procedure with the instrumented libC++? If none of the above works, could you try to provide a minimal test case?

dhbbb commented 3 years ago

Hi,

did you read this C++.txt ? I'm not sure SYMCC_REGULAR_LIBCXX=1 is equivalent to SYMCC_REGULAR_LIBCXX=yes. Did you try the procedure with the instrumented libC++? If none of the above works, could you try to provide a minimal test case?

Yes,i try the procedure with the instrumented libC++,after i set SYMCC_LIBCXX_PATH=/path-provided-as-cmake-install-prefix-for-libcxx in the environment,the problem is solved.Thanks!!

I have another question. I encountered the same problem as this during the fuzzing process. Is there a solution to this problem now?

aurelf commented 3 years ago

Thanks. Good to know. for #45 you can try to use patches that are in this branch https://github.com/vanhauser-thc/symcc