DependableSystemsLab / LLFI

LLFI is an LLVM based fault injection tool, that injects faults into the LLVM IR of the application source code. The faults can be injected into specific program points, and the effect can be easily tracked back to the source code. Please refer to the paper below. NOTE: If you publish a paper using LLFI, please add it to PaperLLFI.bib
http://blogs.ubc.ca/karthik/2014/02/23/quantifying-the-accuracy-of-high-level-fault-injection-techniques/
Other
66 stars 36 forks source link

Cannot take the address of an intrinsic! #89

Open Behroosh opened 8 years ago

Behroosh commented 8 years ago

I am working with "stringsearch" from the MiBench test suite. I managed to instrument it when the target register is the destination register (dstreg). However, I get the following error message when I try to instrument the program using source registers (allsrcreg) as targets.

Cannot take the address of an intrinsic! %fi13 = call void (i8, i8, i64, i32, i1)* (i64, void (i8, i8, i64, i32, i1), i32, i32, i32, i32, i8)* @injectFault17(i64 780, void (i8, i8, i64, i32, i1)* @llvm.memcpy.p0i8.p0i8.i64, i32 49, i32 5, i32 6, i32 6, i8* getelementptr inbounds ([5 x i8]* @call_namestr, i32 0, i32 0)), !llfiinjectfault !1 Cannot take the address of an intrinsic! %fi20 = call void (i8, i8, i64, i32, i1)* (i64, void (i8, i8, i64, i32, i1), i32, i32, i32, i32, i8)* @injectFault17(i64 782, void (i8, i8_, i64, i32, i1)* @llvm.memcpy.p0i8.p0i8.i64, i32 49, i32 5, i32 6, i32 6, i8* getelementptr inbounds ([5 x i8]* @call_namestr, i32 0, i32 0)), !llfi_injectfault !1 Broken module found, compilation aborted! 0 opt 0x00000000011f2942 llvm::sys::PrintStackTrace(_IO_FILE*) + 34 1 opt 0x00000000011f24f4 2 libpthread.so.0 0x00007f528dc2c340 3 libc.so.6 0x00007f528d06dcc9 gsignal + 57 4 libc.so.6 0x00007f528d0710d8 abort + 328 5 opt 0x0000000001117601 6 opt 0x0000000001120f42 7 opt 0x00000000010fb2cf llvm::FPPassManager::runOnFunction(llvm::Function&) + 623 8 opt 0x00000000010fb35b llvm::FPPassManager::runOnModule(llvm::Module&) + 43 9 opt 0x00000000010fd6c5 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 709 10 opt 0x0000000000572264 main + 2452 11 libc.so.6 0x00007f528d058ec5 __libc_start_main + 245 12 opt 0x000000000058d40d Stack dump:

  1. Program arguments: /ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/llvm/bin/opt -load /ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/LLFI2/bin/../llvm_passes/llfi-passes.so -faultinjectionpass -insttype -excludeinst=ret -includeinst=all -regloc -allsrcreg -o /ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/stringsearch/llfi/stringsearch-faultinjection.ll /ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/stringsearch/llfi/stringsearch-llfi_index.ll -S
  2. Running pass 'Function Pass Manager' on module '/ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/stringsearch/llfi/stringsearch-llfi_index.ll'.
  3. Running pass 'Module Verifier' on function '@main'

ERROR: there was an error during running the instrumentation pass, please follow the provided instructions for instrument.

Behroosh commented 8 years ago

Just to add a comment to this issue: Bo managed to instrument the code using his version of LLFI, thus the problem seems to exist in the instrumentation of the current version of LLFI.

Behroosh commented 8 years ago

I also used the latest version of LLFI and still got the same error message.

Behroosh commented 8 years ago

sad also raises the same error!

Behroosh commented 8 years ago

Got the same error when running "sha" from MiBench.

Behroosh commented 8 years ago

The issue disappears when using srcreg1 instead of allsrcreg!

Behroosh commented 8 years ago

Here is a bit of update regarding this issue. The issue is raised during the instrumentation where LLFI wants to instrument the forth parameter sent to the intrinsics function llvm.memcpy. This parameter is the alignment of the source and destination locations which must be a constant int. Here comes the printed error:

alignment argument of memory intrinsics must be a constant int call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* bitcast ([58 x i8] @main.findstrings to i8), i64 464, i32 %fi, i1 false), !llfiindex !9 alignment argument of memory intrinsics must be a constant int call void @llvm.memcpy.p0i8.p0i8.i64(i8 %3, i8* bitcast ([57 x i8] @main.searchstrings to i8), i64 456, i32 %fi1, i1 false), !llfi_index !11 Broken module found, compilation aborted! 0 opt 0x00000000011f2942 llvm::sys::PrintStackTrace(_IOFILE) + 34 1 opt 0x00000000011f24f4 2 libpthread.so.0 0x00007f12a2aa0340 3 libc.so.6 0x00007f12a1ee1c49 gsignal + 57 4 libc.so.6 0x00007f12a1ee5058 abort + 328 5 opt 0x0000000001117601 6 opt 0x0000000001120f42 7 opt 0x00000000010fb2cf llvm::FPPassManager::runOnFunction(llvm::Function&) + 623 8 opt 0x00000000010fb35b llvm::FPPassManager::runOnModule(llvm::Module&) + 43 9 opt 0x00000000010fd6c5 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 709 10 opt 0x0000000000572264 main + 2452 11 libc.so.6 0x00007f12a1eccf45 __libc_start_main + 245 12 opt 0x000000000058d40d Stack dump:

  1. Program arguments: /ubc/ece/home/kp/grads/behsan/Workload/LLFI-build/llvm/bin/opt -load /ubc/ece/home/kp/grads/behsan/Workload/LLFI-build/llfi/bin/../llvm_passes/llfi-passes.so -faultinjectionpass -insttype -includeinst=all -excludeinst=ret -regloc -srcreg4 -o /ubc/ece/home/kp/grads/behsan/Workload/LLFI-build/SampleTest/stringsearch/llfi/stringsearch-faultinjection.ll /ubc/ece/home/kp/grads/behsan/Workload/LLFI-build/SampleTest/stringsearch/llfi/stringsearch-llfi_index.ll -S
  2. Running pass 'Function Pass Manager' on module '/ubc/ece/home/kp/grads/behsan/Workload/LLFI-build/SampleTest/stringsearch/llfi/stringsearch-llfi_index.ll'.
  3. Running pass 'Module Verifier' on function '@main'
nankmr2012 commented 8 years ago

@flyree Hi Bo, Can you please refer to this issue#89. Behrooz mentioned that you were able to instrument. Can you please let me know which version of llvm and llfi you used to instrument it?