Kirenenko icon indicating copy to clipboard operation
Kirenenko copied to clipboard

build failures

Open vanhauser-thc opened this issue 3 years ago • 6 comments

Hi,

I wanted to try out Kirenenko but ran into two problems.

Dockerfile attempt:

srv10201 /Kirenenko # docker build -t kirenenko .
[...]
[ 96%] Building CXX object dfsan_rt/dfsan/CMakeFiles/dfsan_rt-x86_64.dir/dfsan_custom.cc.o
[ 96%] Built target RTSanitizerCommonNoHooks.x86_64
In file included from /kirenenko/llvm_mode/dfsan_rt/dfsan/dfsan.cc:46:
/usr/include/z3++.h:24:9: fatal error: 'cassert' file not found
#include<cassert>
        ^~~~~~~~~
1 error generated.
make[2]: *** [dfsan_rt/dfsan/CMakeFiles/dfsan_rt-x86_64.dir/dfsan.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
dfsan_rt/dfsan/CMakeFiles/dfsan_rt-x86_64.dir/build.make:62: recipe for target 'dfsan_rt/dfsan/CMakeFiles/dfsan_rt-x86_64.dir/dfsan.cc.o' failed
CMakeFiles/Makefile2:1239: recipe for target 'dfsan_rt/dfsan/CMakeFiles/dfsan_rt-x86_64.dir/all' failed
make[1]: *** [dfsan_rt/dfsan/CMakeFiles/dfsan_rt-x86_64.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Linking CXX shared module libUnfoldBranchPass.so
[ 96%] Built target UnfoldBranchPass
[ 97%] Linking CXX shared module libAngoraPass.so
[ 97%] Built target AngoraPass
[ 97%] Linking CXX shared module libTaintPass.so
[ 97%] Built target TaintPass
[ 98%] Linking CXX shared module libDFSanPass.so
[ 98%] Built target DFSanPass
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c ./build/build.sh' returned a non-zero code: 2

plain build attempt (clang 6.0):

srv10201 /Kirenenko/llvm_mode/build # make
[  1%] Built target KOClang
[  2%] Built target TaintPass
[  3%] Built target DFSanPass
[  4%] Built target AngoraPass
[  5%] Built target UnfoldBranchPass
[  6%] Built target taint_linker_script
[  7%] Built target RTInterception.x86_64
[  7%] Building CXX object dfsan_rt/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o
/Kirenenko/llvm_mode/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.cc:1163:1: error: 
      'assertion_failed__1163' declared as an array with a negative size
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Kirenenko/llvm_mode/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.h:1513:3: note: 
      expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Kirenenko/llvm_mode/dfsan_rt/sanitizer_common/sanitizer_internal_defs.h:336:30: note: 
      expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Kirenenko/llvm_mode/dfsan_rt/sanitizer_common/sanitizer_internal_defs.h:342:57: note: 
      expanded from macro 'IMPL_COMPILER_ASSERT'
    typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                        ^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [dfsan_rt/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/build.make:310: dfsan_rt/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:568: dfsan_rt/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

so ... what is the shortest path to get a working build? thank you.

vanhauser-thc avatar Apr 02 '21 11:04 vanhauser-thc

@vanhauser-thc Did you succeed to build the Kirenenko?

Microsvuln avatar Apr 07 '21 16:04 Microsvuln

in the dockerfile, yes not native though.

vanhauser-thc avatar Apr 07 '21 18:04 vanhauser-thc

strange, why I didn't get notification for this ...

releases after 18.04 needs a new sanitizer_runtime so docker is the best option now. I'll try to push a newer branch with the toolchain updated to llvm-12.

ChengyuSong avatar May 14 '21 16:05 ChengyuSong

@vanhauser-thc the bounds_tracking branch is on llvm-12 now and build fine on my Ubuntu 20.04 machine

ChengyuSong avatar May 24 '21 06:05 ChengyuSong

@ChengyuSong good news! and I saw you plan to add FP support :)

vanhauser-thc avatar May 24 '21 12:05 vanhauser-thc

I ran into the same issue today when trying GitHub actions, it's likely due to missing libc++-dev and libc++-abi-dev.

ChengyuSong avatar Jul 14 '22 03:07 ChengyuSong

@vanhauser-thc I just ran into the same issue today, almost 3 yrs later, when build with clang-6.0 toolchain on Ubuntu 20.04 LTS.

Fortunately I've found a solution :)

diff --git a/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.cc b/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.cc
index 54da635..baacef5 100644
--- a/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1158,7 +1158,7 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
 /* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
diff --git a/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.h b/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.h
index f89a113..f6f986f 100644
--- a/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/third-party/ko/dfsan_rt/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -213,26 +213,13 @@ namespace __sanitizer {
     u64 __unused1;
     u64 __unused2;
 #elif defined(__sparc__)
-#if defined(__arch64__)
     unsigned mode;
-    unsigned short __pad1;
-#else
-    unsigned short __pad1;
-    unsigned short mode;
     unsigned short __pad2;
-#endif
     unsigned short __seq;
     unsigned long long __unused1;
     unsigned long long __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
-    unsigned int mode;
-    unsigned short __seq;
-    unsigned short __pad1;
-    unsigned long __unused1;
-    unsigned long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
+    unsigned int mode;
     unsigned short __seq;
     unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)

Refs:

  • https://github.com/OleksiiOleksenko/SpecFuzz/issues/24#issuecomment-905708211
  • https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce

@ChengyuSong This issue can be closed now.

SonicStark avatar May 14 '24 09:05 SonicStark

Thanks! This repo is no longer maintained. Let me archive it. Please use https://github.com/R-Fuzz/symsan instead.

ChengyuSong avatar May 14 '24 16:05 ChengyuSong