santoshn / softboundcets-3.8.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors when running the Cicro benchmark suite

mrigger opened this issue · comments

Hi, I'm trying to run Softbound+CETS on the Cicro benchmark suite. During run time, Softbound signals a memory safety violation for every benchmark, which is not the case for other tools (such as ASan, MSan, and Valgrind). Here is one example output:

[2019-04-17 09:54:57,802] [ WARNING  ]  benchmark harness had some output on stderr:
In LDC, base=7ffdc3f4ff38, bound=7ffdc3f4ff50, ptr=7ffdc3f4fb38

Softboundcets: Memory safety violation detected

Backtrace:
/benchmarks/benchmarks/bashrc-libdeep_test[0x505f25]
/benchmarks/benchmarks/bashrc-libdeep_test[0x5057fc]
/benchmarks/benchmarks/bashrc-libdeep_test[0x4fe2c4]
/lib/x86_64-linux-gnu/libc.so.6(argp_parse+0x647)[0x7fced3219597]
/benchmarks/benchmarks/bashrc-libdeep_test[0x4fe103]
/benchmarks/benchmarks/bashrc-libdeep_test[0x406035]
/benchmarks/benchmarks/bashrc-libdeep_test[0x506162]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fced310bb97]
/benchmarks/benchmarks/bashrc-libdeep_test[0x404e5a]

Additionally, a number of benchmarks do not compile due to various issues, such as the ones outlined below:

clang-3.8: /softboundcets-3.8.0/llvm-38/lib/Transforms/Instrumentation/SoftBoundCETS.cpp:3831: void SoftBoundCETS::addDereferenceChecks(llvm::Function*): Assertion `0 && "Atomic Instructions not handled"' failed.
[...]
clang-3.8: /softboundcets-3.8.0/llvm-38/lib/Transforms/Instrumentation/SoftBoundCETS.cpp:4506: void SoftBoundCETS::handleExtractValue(llvm::ExtractValueInst*): Assertion `0 && "ExtractValue is returning a pointer, possibly some vectorization going on, not handled, try running with O0 or O1 or O2"' failed.
[...]
clang-3.8: /softboundcets-3.8.0/llvm-38/lib/Transforms/Instrumentation/FixByValAttributes.cpp:357: bool FixByValAttributes::transformFunction(llvm::Function*): Assertion `struct_type && "non-struct byval parameters?"' failed.
[...]
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: [build/test/t-zz] Error 1 (ignored)
#0 0x00005635a611be85 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x2b8ee85)
#1 0x00005635a611c1d7 PrintStackTraceSignalHandler(void*) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x2b8f1d7)
#2 0x00005635a611a60c llvm::sys::RunSignalHandlers() (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x2b8d60c)
#3 0x00005635a611b7c0 SignalHandler(int) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x2b8e7c0)
#4 0x00007f633aecb890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007f633a1c7e97 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x3ee97)
#6 0x00007f633a1c9801 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40801)
#7 0x00007f633a1b939a (/lib/x86_64-linux-gnu/libc.so.6+0x3039a)
#8 0x00007f633a1b9412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#9 0x00005635a6c26fe4 SoftBoundCETS::addDereferenceChecks(llvm::Function*) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x3699fe4)
#10 0x00005635a6c2d815 SoftBoundCETS::runOnModule(llvm::Module&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x36a0815)
#11 0x00005635a5c38c4b (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x26abc4b)
#12 0x00005635a5c39391 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x26ac391)
#13 0x00005635a5c39589 llvm::legacy::PassManager::run(llvm::Module&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x26ac589)
#14 0x00005635a631c837 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, llvm::raw_pwrite_stream*) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x2d8f837)
#15 0x00005635a631c9aa clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x2d8f9aa)
#16 0x00005635a6b957ea clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x36087ea)
#17 0x00005635a745ecae clang::ParseAST(clang::Sema&, bool, bool) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x3ed1cae)
#18 0x00005635a67e5415 clang::ASTFrontendAction::ExecuteAction() (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x3258415)
#19 0x00005635a6b9865c clang::CodeGenAction::ExecuteAction() (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x360b65c)
#20 0x00005635a67e4eac clang::FrontendAction::Execute() (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x3257eac)
#21 0x00005635a679ba42 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x320ea42)
#22 0x00005635a68e9b21 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x335cb21)
#23 0x00005635a485faf3 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x12d2af3)
#24 0x00005635a4856362 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x12c9362)
#25 0x00005635a4856e45 main (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x12c9e45)
#26 0x00007f633a1aab97 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#27 0x00005635a48524ba _start (/softboundcets-3.8.0/llvm-38/build/bin/clang-3.8+0x12c54ba)
Stack dump:
0.	Program arguments: /softboundcets-3.8.0/llvm-38/build/bin/clang-3.8 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name work_item.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir /softboundcets-3.8.0/llvm-38/build/bin/../lib/clang/3.8.0 -I ../C-Hayai/src -I yosefk-checkedthreads/include -internal-isystem /usr/local/include -internal-isystem /softboundcets-3.8.0/llvm-38/build/bin/../lib/clang/3.8.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir /benchmarks/benchmarks -ferror-limit 19 -fmessage-length 0 -fsoftboundcets -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /tmp/work_item-70fdd2.o -x c yosefk-checkedthreads/src/work_item.c 
1.	<eof> parser at end of file
2.	Per-module optimization passes
3.	Running pass ' SoftBoundCETS' on module 'yosefk-checkedthreads/src/work_item.c'.
clang-3.8: error: unable to execute command: Aborted (core dumped)
clang-3.8: error: clang frontend command failed due to signal (use -v to see invocation)
clang-3.8: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.8.0 (tags/RELEASE_380/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /softboundcets-3.8.0/llvm-38/build/bin
clang-3.8: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-3.8: note: diagnostic msg: 

Do you have any advice on how to address these issues?

For the memory safety violation, the bounds associated with the access seems to indicate that it is out-of-bounds access. It needs to be debugged to figure if it is a true out-of-bounds access or a false violation.

To handle the second issue, the pass needs to be updated to handle atomic instructions in the LLVM IR. Although it is on my todo list, I don't have anyone working on it right now.