GithubHelp home page GithubHelp logo

dependablesystemslab / llfi Goto Github PK

View Code? Open in Web Editor NEW
66.0 17.0 36.0 154.72 MB

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

Home Page: http://blogs.ubc.ca/karthik/2014/02/23/quantifying-the-accuracy-of-high-level-fault-injection-techniques/

License: Other

Java 54.77% Shell 0.18% Python 12.80% C++ 9.18% C 14.91% CMake 0.46% Makefile 0.16% TeX 0.40% JavaScript 5.50% HTML 0.19% CSS 0.62% Batchfile 0.01% GAP 0.82%

llfi's Introduction

LLFI

NOTE: We're in the process of updating LLFI to use the latest LLVM version, and also support Machine Learning (ML) operations. Please see LLTFI (https://github.com/DependableSystemsLab/LLTFI) for further details. From now on, LLFI development will be restricted to bug fixes and security updates, and any new features will be added only to LLTFI. However, LLTFI doesn't yet support software failure modes.

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. LLFI is typically used to map fault characteristics back to source code, and hence understand source level or program characteristics for various kinds of fault outcomes. Detailed documentation about LLFI can be found at: https://github.com/DependableSystemsLab/LLFI/wiki

Please join the following Google Groups for asking questions about LLFI that are not answered in the documentation: [email protected]

Auto-Installer

This is the recommended method for building the LLFI. If you wish to build the LLFI via the auto-installer, you do not need to clone the LLFI git repository. Simply download the installer script by itself, and it will fetch the latest version of the git repository for you. The LLFI auto-installer takes the form of a single python script (installer/installLLFI.py). To run the script, simply copy it into the directory where you would like to build the LLFI and, from the command line, run python3 InstallLLFI.py.

Dependencies:

  1. 64 Bit Machine
  2. 64 Bit Linux or OS X
  3. Cmake (mininum v2.8)
  4. Python 3 and above
  5. tcsh (for GUI)
  6. GraphViz package (for visualizing error propagation)
  7. Internet Connection

GUI Dependencies:

  1. JDK7/JDK8 with JavaFX
  2. tcsh shell

Usage: run "python3 InstallLLFI.py -h" to see all running options/guidelines

  1. Copy the InstallLLFI.py script to where you want to build the LLFI
  2. Make sure you are not logged in as root
  3. Run "python3 InstallLLFI.py"
  4. Wait for compilation to finish
  5. Run the GUI by executing "./llfi-gui" under the bin/ folder

About tcsh:

The LLFI-GUI uses tcsh to read environment variables describing the location of the LLFI build. The installer will automatically add those environment variables to your ~/.tcshrc file. You do not need to actively use tcsh as your primary shell, simply having it installed is enough.

Manual Install

This method is also available, and may be more suitable if you want more control over the location of the LLVM build that the LLFI requires (ie, you already have LLVM built and wish to use that build).

Dependencies:

  1. 64 Machine with 64 bit Linux or OS X
  2. CMake (minimum v2.8)
  3. Python 3 and above
  4. Python YAML library (PyYAML)
  5. Clang v3.4
  6. LLVM v3.4, built with CMake * Build llvm-3.4 WITH CMAKE using flag -DLLVM_REQUIRES_RTTI=1. Instructions * Remember to run make in the llvm build directory after running cmake.
  7. GraphViz package (for visualizing error propagation)

GUI Dependencies:

  1. JDK7/JDK8 with JavaFX
  2. tcsh shell

Building:

Run ./setup --help for build instructions.

  $ ./setup --help

  Usage: setup OPTIONS
  List of options:
  -LLVM_DST_ROOT <LLVM CMake build root dir>:
      Make sure you build LLVM with CMake and pass build root directory here
  -LLVM_SRC_ROOT <LLVM source root dir>
  -LLFI_BUILD_ROOT <path where you want to build LLFI>
  -LLVM_GXX_BIN_DIR <llvm-gcc/g++'s parent dir> (optional):
      You don't need to set it if it is in system path
  -JAVA_HOME_DIR <java home directory for oracle jdk 7 or higher> (optional):
    You don't need to set it if your default jdk is oracle jdk 7 or higher and in system path


  --help(-h): show help information
  --no_gui: Add this option if you do not want GUI.
  --runTests: Add this option if you want to run all regression tests after building LLFI.

Here is a sample build command if clang and javac are already in $PATH:

  ./setup -LLFI_BUILD_ROOT $BUILD/LLFI -LLVM_SRC_ROOT $SRC/llvm-3.4 -LLVM_DST_ROOT $BUILD/llvm-3.4

Build without GUI: To build LLFI without GUI, just add option: --no_gui in the command line for setup, for example:

./setup -LLFI_BUILD_ROOT $BUILD/LLFI -LLVM_SRC_ROOT $SRC/llvm-3.4 -LLVM_DST_ROOT $BUILD/llvm-3.4 --no_gui

Running tests: Running all regression tests after installation is highly recommended. Note that you may encounter some error messages during the fault injection stage. This is normal. Once all tests have completed and they all passed, LLFI is correctly installed.

VirtualBox Image

If you want to quickly try out LLFI, an Ubuntu image with LLFI and its dependencies pre-installed is available here (2.60GB). This image is built with VirtualBox v4.3.26, with Ubuntu 14.04.2 LTS, LLVM v3.4, CMake v3.4 and the current master branch version of LLFI (as of Sep 16th, 2015).

user: llfi
password: root

<LLFI_SRC_ROOT> is located under ~/Desktop/llfisrc/.
<LLFI_BUILD_ROOT> is located under ~/Desktop/llfi/.
<LLVM_SRC_ROOT> is located under ~/Desktop/llvmsrc/.
<LLVM_DST_ROOT> is located under ~/Desktop/llvm/.
<LLVM_GXX_BIN_DIR > is located under ~/Desktop/llvm/bin/.

Sample tests can be found under ~/Desktop/test/.

To run it, open VirtualBox, select File->Import Appliance... and navigate to the .ova file.

Running

You can use test programs in the directory sample_programs/ or test_suite/PROGRAMS/ to test LLFI. Programs in the sample_programs directory already contains a valid input.yaml file. ####Command line Example program: factorial

  1. Copy the sample_programs/factorial/ directory to your project directory.
  2. Change to your factorial directory Build a single IR file with the LLFI tool GenerateMakefile
    <LLFI_BUILD_ROOT>/tools/GenerateMakefile --readable --all -o factorial.ll
    
    Alternatively, you can build your own IR file with clang.
  3. Instrument factorial with calls to LLFI libraries and create executables under llfi directory
    <LLFI_BUILD_ROOT>/bin/instrument --readable factorial.ll
    
  4. Run factorial executable with profiling functions instrumented
    <LLFI_BUILD_ROOT>/bin/profile ./llfi/factorial-profiling.exe 6
    
    In file llfi/baseline/golden_std_output, you should be able to see 720
  5. Run factorial executable with fault injection functions instrumented
    <LLFI_BUILD_ROOT>/bin/injectfault ./llfi/factorial-faultinjection.exe 6
    

For complete test of whole of LLFI, please use LLFI test suite and refer to wiki page: Test suite for regression test for details.

####GUI If you have used ./setup to install LLFI, you need to set new environment variables for tcsh shell before running the GUI for the first time. Open ~/.tcshrc using your favourite text editor and add setenv llfibuild <LLFI_BUILD_ROOT>/ and setenv zgrviewer <LLFI_BUILD_ROOT>/tools/zgrviewer/ to it. [OPTIONAL] Create an environment variable "COMPARE" with the path of the SDC check script.

Execute <LLFI_BUILD_ROOT>/bin/llfi-gui to start the GUI. The outputs will be saved in the directory where you have executed the command.

####Web GUI Development Environment Setup Dependencies: Nodejs webpack

Steps to set up the development environment:
1: Download this project from Git
2: Download NodeJs
3: Install libraries: Go to the web-app directory and run "npm install"
4: Install Webpack: In the same directory as step 3, run "sudo npm install -g webpack"
5: Configurate the LLFI root path for the server:
The default bevaiour of the program use environment variable $llfibuild as the path of the llfi build directory
You can set the environment variable llfibuild in your system to point it to the LLFI build directory in your local machine.

Start the server:
Go to the /web-app/server folder and run "node server.js"

Start the front-end dev tool:
Go to the web-app directory and run "webpack" or "webpack -w"

Results

After fault injection, output from LLFI and the tested application can be found in the llfi directory.

Directory Contents
std_output Piped STDOUT from the tested application
llfi_stat_output Fault injection statistics
error_output Failure reports (program crashes, hangs, etc.)
trace_report_output Faults propogation report files and graph

References

====== Read caveats.txt for caveats and known problems.

llfi's People

Contributors

abrahamchan avatar anna-thomas avatar behroosh avatar cclinus avatar chipbuster avatar jshwei avatar karfair avatar karthikp-ubc avatar kcehvoin avatar lpalazzi avatar maryamra avatar nankmr2012 avatar nithya11 avatar qining avatar samwcoulter avatar shadensmith avatar syltaxue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

llfi's Issues

Regression Test Problem

Hi,
My system is Ubuntu 14.04(64 bit).

When i start to do the regression test, it turns out that there may be some problems.

After the injections, it shows that

MSG: instrument succeed for: /home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype MCF.ll
MSG: profile succeed for: /home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype MCF.ll inp.in
*** Error in /home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype/llfi/MCF-faultinjection.exe': double free or corruption (top): 0x00000000010fc7a0 *** *** Error in/home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype/llfi/MCF-faultinjection.exe': double free or corruption (top): 0x0000000001bd37a0 ***
*** Error in /home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype/llfi/MCF-faultinjection.exe': double free or corruption (top): 0x0000000000e2f7a0 *** *** Error in/home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype/llfi/MCF-faultinjection.exe': double free or corruption (top): 0x00000000015817a0 ***
*** Error in `/home/ma/faultInjection/llfidst/test_suite/HardwareFaults/insttype/llfi/MCF-faultinjection.exe': double free or corruption (top): 0x00000000015447a0 ***
MSG: Injection for: test_suite HardwareFaults insttype/MCF.ll finished!

The test on factorial goes well, but most of the injections on other programs show "double free or corruption"(just like the regression test) or "free: invalid next size".

what should i do, thanks

tracegraph oneoff error

Tracegraph reports llfi index 64 as the injection point, whereas the real injection is llfi index 63:
image

When tracegraph are generated, the reported injection point in the graph is off by one unless a 'ret' instruction is injected or no SDC occurs.

No error:
image

This seems to be due to the llfi.stat.trace.*-*.txt (under llfi/llfi_stat_output) outputting the instruction _after_ the fault injected instruction.
This leads to the TraceDiffReportFile.*-*.txt (under llfi/trace_report_output, generated by the tool tracediff.py) being one off, and leads to the generated graph being one off.

llfi.stat.trace.*-*.txt reporting the instruction after the fault injected instruction seems to be because in some cases, during instrumentation, calls to @printInstTrace happens before calls to @injectFault. Since @printInstTrace tracks whether the fault has been injected yet and also generates the llfi.stat.trace file, it detects the fault being injected in the next instruction instead of the current instruction.

Changing the pass order (calling the -insttracepass before the -faultinjection pass) works in some cases but in some cases the faultinjection executable will just hang so this is not a solution.

This issue only affects the generated tracegraph file and nothing else.

injectfault.py crashes when fi_bit is specified

I'm attempting to use the fi_bit option for a fault injection routine. Here is the relevant portion of my input.yaml file:

    - run:
        numOfRuns: 100
        fi_type: bitflip
        fi_bit: 3

And I get the following error:

---FI Config #0---
Traceback (most recent call last):
  File "<omitted>/build-dev-llfi/bin/injectfault", line 378, in <module>
    main(sys.argv[1:])
  File "<omitted>/build-dev-llfi/bin/injectfault", line 313, in main
    checkValues("fi_bit",fi_bit,run_number,fi_cycle,fi_index,fi_reg_index)
UnboundLocalError: local variable 'fi_cycle' referenced before assignment

Looking at injectfault.py, I see that all run options are being checked when fi_bit is found during parsing. This is inconsistent with the other checks performed and would only work when fi_bit is set last, after all other options.

 if "fi_reg_index" in run["run"]:
   fi_reg_index=run["run"]["fi_reg_index"]
   checkValues("fi_reg_index",fi_reg_index)
 if "fi_bit" in run["run"]:
   fi_bit=run["run"]["fi_bit"]
   checkValues("fi_bit",fi_bit,run_number,fi_cycle,fi_index,fi_reg_index)

I think the correction here should be:

 if "fi_bit" in run["run"]:
   fi_bit=run["run"]["fi_bit"]
   checkValues("fi_bit",fi_bit)

GUI generated llfi.stat.totalindex.txt is one off

for example, using the GUI & the factorial.c file
pic

The "No.of.Index" (from llfi.stat.totalindex.txt) and the last index from factorial-llfi_displayIndex.ll differs by 1. I am not sure which script is responsible for generating these two files and I am not sure what the correct behavior should be.

Manual Installation

Hi all,

I was trying to follow the instructions for manual install, but when I run ./setup, I got an error message that python must be in version 3. But on the webpage, it says python 2.7 and above. If I change the python in setup to 2, I always got this message:
File "./setup", line 44
print(msg, file=sys.stderr)
^
SyntaxError: invalid syntax

This is not consistent. Another question, why limit the user to use Python 3?

Bo

Random Hardware Fault

When trying to instrument e.g., the factorial.c example with the "random" input.yaml file the program raises an exception on the commandline and nothing is selected.

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1770)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1653)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8390)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3758)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3486)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2495)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:350)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$350(GlassViewEventHandler.java:385)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$347/1299860005.get(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:384)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:927)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
at com.sun.glass.ui.gtk.GtkApplication$$Lambda$41/1766822961.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1765)
... 50 more
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at application.InputYaml.load(InputYaml.java:109)
at application.InstrumentController.loadProfile(InstrumentController.java:539)
at application.InstrumentController.onClickSelectProfile(InstrumentController.java:533)
... 60 more

Executing fault injection in 32-bit linux system

When fault injection is performed the llfi.stat files are not generated and it results as follows: (This occurs only for 32-bit system and works fine for 64-bit)

factorial-faultinjection.exe: /home/nithyan/Installer-Package/llfisrc/runtime_lib/FaultInjectionLib.c:135: preFunc: Assertion `opcodecyclearray[opcode] >= 0 && "opcode does not exist, need to update instructions.def"' failed.

Kernel: Forcing run

Run fault injection executable with default timeout 500

======Fault Injection======

---FI Config #0---

[>--------------------------------------------------] 0.0% (0 / 2) factorial-faultinjection.exe: /home/nithyan/Installer-Package/llfisrc/runtime_lib/FaultInjectionLib.c:135: preFunc: Assertion `opcodecyclearray[opcode] >= 0 && "opcode does not exist, need to update instructions.def"' failed.

[=========================>-------------------------] 50.0% (1 / 2)

[==================================================>] 100.0% (2 / 2)

The unwind destination does not have a landingpad instruction!

I am working with "bfs" from the suggested test programs. I managed to instrument it when the target register is the destination register (dstreg). However, I get the following error message (in the instrumentation phase) when having source registers (allsrcreg) as target registers.

The unwind destination does not have a landingpad instruction!
invoke void @_ZNSt5dequeIiSaIiEE9push_backERKi(%"class.std::deque"* %wavefront, i32* %5)
to label %8 unwind label %73, !llfi_index !18
The unwind destination does not have a landingpad instruction!
%14 = invoke zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(%"class.std::deque"* %wavefront)
to label %15 unwind label %73, !llfi_index !25
The unwind destination does not have a landingpad instruction!
%18 = invoke i32* @ZNSt5dequeIiSaIiEE5frontEv(%"class.std::deque"* %wavefront)
to label %19 unwind label %73, !llfi_index !28
The unwind destination does not have a landingpad instruction!
invoke void @ZNSt5dequeIiSaIiEE9pop_frontEv(%"class.std::deque"* %wavefront)
to label %21 unwind label %73, !llfi_index !31
The unwind destination does not have a landingpad instruction!
invoke void @ZNSt5dequeIiSaIiEE9push_backERKi(%"class.std::deque"* %wavefront, i32* %id)
to label %68 unwind label %73, !llfi_index !81
LandingPadInst not the first non-PHI instruction in the block.
%74 = landingpad { i8
, i32 } personality i8
bitcast (i32 (...)* @gxx_personality_v0 to i8)
cleanup, !llfi_index !88
The unwind destination does not have a landingpad instruction!
invoke void @ZNSt5dequeIiSaIiEED2Ev(%"class.std::deque" %wavefront)
to label %87 unwind label %93, !llfi_index !93
LandingPadInst not the first non-PHI instruction in the block.
%94 = landingpad { i8
, i32 } personality i8
bitcast (i32 (...)* @gxx_personality_v0 to i8)
catch i8
null, !llfi_index !113
Broken module found, compilation aborted!
0 opt 0x00000000011f2942 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1 opt 0x00000000011f24f4
2 libpthread.so.0 0x00007f46bc78f340
3 libc.so.6 0x00007f46bbbd0cc9 gsignal + 57
4 libc.so.6 0x00007f46bbbd40d8 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 0x00007f46bbbbbec5 __libc_start_main + 245
12 opt 0x000000000058d40d
Stack dump:
0. 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 -profilingpass -insttype -excludeinst=ret -includeinst=all -regloc -allsrcreg -o /ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/bfs-allsrcreg/llfi/bfs-profiling.ll /ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/bfs-allsrcreg/llfi/bfs-llfi_index.ll -S

  1. Running pass 'Function Pass Manager' on module '/ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/bfs-allsrcreg/llfi/bfs-llfi_index.ll'.
  2. Running pass 'Module Verifier' on function '@_Z7BFS_CPUP4NodeP4EdgePiS3_i'

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

when i execute the step3,it has error as this.

root@SZX1000074727:/mnt/llfi20160324/llfi/test_suite/HardwareFaults/insttype# cat llfi.test.log.instrument.txt
Error opening '/mnt/llfi20160324/llfi/bin/../llvm_passes/llfi-passes.so': /mnt/llfi20160324/llfi/bin/../llvm_passes/llfi-passes.so: undefined symbol: _ZN4llvm2cl3optISsLb0ENS0_6parserISsEEE15setInitialValueERKSs
-load request ignored.
opt: Unknown command line argument '-genllfiindexpass'. Try: '/mnt/llfi20160324/llvm/bin/opt -help'
opt: Did you mean '-inline-cost'?

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

Inconsistency in fi_index

The fi_index starts from 1 in the PROGRAM-faultinjection.ll and PROGRAM-llfi_index. However, the fi_index is counted from zero in files such as llfi.stat.trace.prof (golden run), llfi.stat.trace (fault injection run) and llfi.stat.fi.injectedfaults. This causes some inconsistency in the trace files and the instructions that have actually been targeted.

How I can generate a single .ll file out of c sources and header files?

Hi,

I used the LLFI GUI tool to generate a trace graph but the problem is that when I load the files of my project it generates a makefile to create multiples .ll files instead of a single one.

Do I have to use the command line tool "GenerateMakefile" to create a make file for a single .ll file? and if so, how I can do that?

Best,

what‘s wrong with this:Exception in thread "main" when i run"./llfi-gui"

gandalf@SZX1000074727:/mnt/llfi20160324/llfi/bin$ ./llfi-gui
/usr/local/jdk1.8.0_45/bin/java -classpath /usr/local/jdk1.8.0_45/./jre/lib/:/usr/local/jdk1.8.0_45/./jre/lib/ext/:/mnt/llfi20160324/llfisrc/./gui/application/lib/:/mnt/llfi20160324/llfi/bin/../gui/application/lib/:/mnt/llfi20160324/llfi/bin/../gui application.Main
gandalf@SZX1000074727:/mnt/llfi20160324/llfi/bin$ Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY
at com.sun.glass.ui.gtk.GtkApplication.(GtkApplication.java:68)
at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
at com.sun.glass.ui.Application.run(Application.java:146)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:263)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more

Instruction does not dominate all uses!

I meet this problem when running instrument, the problem comes from read file, and the llvm error looks like this:
Instruction does not dominate all uses!
%230 = invoke %"class.std::__1::basic_istream"* @_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsERi(%"class.std::__1::basic_istream"* %229, i32* %nonezero)
to label %231 unwind label %237, !llfi_index !316
store %"class.std::__1::basic_istream"* %230, %"class.std::__1::basic_istream"* %llfi_trace630
Broken module found, compilation aborted!
0 opt 0x0000000103c77778 llvm::sys::PrintStackTrace(__sFILE
) + 40
1 opt 0x0000000103c77c30 SignalHandler(int) + 416
2 libsystem_platform.dylib 0x00007fff93b2deaa _sigtramp + 26
......

The problem comes from below code in instrument:
if retcode == 0:
execlist = [optbin, '-load', llfilib, '-profilingpass']
execlist2 = ['-o', proffile + _suffixOfIR(), llfi_indexed_file + _suffixOfIR()]
print(execlist)
execlist.extend(compileOptions)
execlist.extend(execlist2)
if options["readable"]:
execlist.append("-S")
retcode = execCompilation(exec list)
and retcode return -4.

The platform I use is OS X 10.11, and I run with the simple install version of LLFI, another thing need to mention is that when generate makefile, I have to add std head file into the clang++ search path
--stdlib=libc++ -isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/
to make it compile. Otherwise, clang++ will not find

the code segment that I run met the above problem shows below
`#include

include

include

using namespace std;
int main(int argc, const char * argv[]) {

int rows; int cols ; int nonezero; //get the size of input matrix
//int n = 3;

typedef Eigen::Triplet<double> T;//use to store row, col, v_ij

vector<T> tripletList;  //use to store all the row

/***************beging to construct the matrix****************/

 fstream read;

 read.open("/Users/wuyue/Desktop/dataset/bcsstm22.mtx", ios::in);

int row=0 ; int col=0; float value=0; //get the value
read>>rows; read >> cols; read>>nonezero;

// cout<<"matrix has "<<rows<<" rows "<< cols<<" cols "<<nonezero<<" nonezero values"<<endl;
}`

Software Failures description/implementation error

For the some of the Software Failures listed here (marked in bold), I don't it it does what it's suppose to do.

RaceCondition(Timing)

Does nothing as PTHREAD_MUTEX_INITIALIZER initializes another mutex which is then unlocked?

virtual void injectFault(long llfi_index, unsigned size, unsigned fi_bit,char *buf){
        pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
        pthread_mutex_unlock(&mutex);
        return;
    }

ThreadKiller(Res)

Does the wrong thing as

int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
        void *(*start_routine)(void*), void *arg);
    From <http://pubs.opengroup.org/onlinepubs/007908799/xsh/pthread_create.html> 

int pthread_join(pthread_t thread, void **value_ptr);
    From <http://pubs.opengroup.org/onlinepubs/007908799/xsh/pthread_join.html> 

type difference between: pthread_t * and pthread_t, but the injection function assumes they are typed as pthread_t.

virtual void injectFault(long llfi_index, unsigned size, unsigned fi_bit,char *buf){
        pthread_t t = pthread_t(*buf);
        sleep(0.02);
        pthread_cancel(t);
        return;
    }

Deadlock(Res)

injects a deadlock before a call to pthread_join but only on the calling thread, not both. (doubles lock the mutex1 in the calling thread.

virtual void injectFault(long llfi_index, unsigned size, unsigned fi_bit,char *buf){
        pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
        pthread_mutex_lock(&mutex1);
        pthread_t thread1 = pthread_t(*buf);
        pthread_join(thread1, NULL);
        pthread_mutex_lock(&mutex1);
        return;
    }

Inst Trace causes crashes in LLFI ( version for LLVM 3.3)

The crash happens when the instruction trace is enabled. The program didn't crash when it was small, meaning the amount of dynamic number of instructions are small, but it crashes if you increase the size of the problem.

A simple program would show this issue:

For a piece of code likes this:

include <stdio.h>

int main() {
int i;
for(i= 0; i< 100; i++){
i = i +1;
}
printf("i is %d\n",i);
return 0;
}

There won't be a crash. But if we increase the size of the for loop to say, 1000000, the crash will happen.

An initial idea is that it can be related to the number of "Alloc" that LLFI creates to log the opcode for each instruction.

Bo

instrument pass fails on Cellular-Automata benchmark

Compiled C code to IR in https://github.com/logan-j/Cellular-Automata/tree/master

Then run instrument from currenct version of LLFI, it gives:


terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Stack dump:
0. Program arguments: /data/gpli/llvm-2.9-build/bin/opt -load /data/gpli/LLFI-BUILD/bin/../llvm_passes/llfi-passes.so -profilingpass -insttype -includeinst=all -excludeinst=ret -excludeinst=alloca -excludeinst=call -regloc -dstreg -o /data/gpli/workplace/benchmarks/cellular_automata/llfi/life_final-profiling.ll /data/gpli/workplace/benchmarks/cellular_automata/llfi/life_final-llfi_index.ll -S

  1.  Running pass 'Profiling pass' on module '/data/gpli/workplace/benchmarks/cellular_automata/llfi/life_final-llfi_index.ll'.
    

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


Contact me to get the compiled IR as I can not upload file here.

About llfi.stat.fi.injectedfaults file

Dear Author,

I am currently going over the steps abot LLFI, but find that I could not find llfi.stat.fi.injectedfaults file. Here are several specific questions:

  1. I use the default configuration in test-programs folder, and go over all scripts, including compileIR, instrument, profile and faultinject, but I cannot find llfi.stat.fi.injectedfaults in the llfi_stat_output folder. Have you ever faced the problem like this before ?
  2. I spend some days in studying into the source code of runtime_lib, and find that "llfi.stat.fi.injectedfaults.txt" should be generated in initInjections() function, which is defined in FaultInjectionLib.c. Is my statement above correct ?
  3. I copied part of the result generated by "instrument" script, like below

['clang', '-o', '/media/xnwang30/Storage/LLFI/LLFI/test_programs/factorial/llfi/factorial-profiling.exe', '/media/xnwang30/Storage/LLFI/LLFI/test_programs/factorial/llfi/factorial-profiling.o', '-L/media/xnwang30/Storage/LLFI/LLFI/LLFI_Obj1/bin/../runtime_lib', '-lllfi-rt', '-Wl,-rpath', '/media/xnwang30/Storage/LLFI/LLFI/LLFI_Obj1/bin/../runtime_lib']

I see the "-L" option followed by a folder's path, which should be the so-called "library". Currently I get no idea of how to program a library. Usually there should be a "main" in a program, but I see no function like that exists. Could you provide me a clue that how should I understand about runtime_lib files, or "-L" related function of Clang ?

Thank you,
Xianan

about fi_cycle in injectfault script in bin

Dear author,

I am trying to study into the scripts of LLFI recently.

About the problem, I feel it is a little bit odd about fi_cycle. I think this variable is defined to be a param to stand for in which cycle the fault should be injected to (I am not sure this understanding), but I find that in "injectfault.py" script, fi_cycle is just read from input.yaml or generated randomly, without influencing the execution of faultinjection.exe. Does it mean that fi_cycle does actually no effect?

Thanks,
Xianan

I can't find the LLFI development group, sorry for post it here again

Hi,

Sorry for posting it here but I didn't find the LLFI development group and I don't know other way of communication other than this. In the home page it says:

"Please join the following Google Groups for information related to LLFI development: [email protected]"

But it is just an email address which throws an error whenever I send an email. I also searched on the internet the google group but I didn't find it. I just found the LLVM development group. Is that the group?

Best,

I can't compile OpenMP programs

Hi,

I'm using the GUI tool to generate a trace graph but the problem is that I'm getting and error when I tried to instrument the file. This is the error:

/home/llfi/Desktop/llfi/bin/Testing/llfi/Testing-profiling.ll:(.text+0xb4f): undefined reference to `omp_set_num_threads'

I also tried with a hello world openMP example but it didn't even pass the "Compile To IR" stage. This is the error:

openmp_simple.c:3:10: fatal error: 'omp.h' file not found

include "omp.h"

     ^

1 error generated.
make: *** [openmp_simple.ll] Error 1

Can you help me please?

Best,

Using llfiindex Custom Fault Injection Instruction Selector

I'm trying to use the the llfiindex fault injection instruction selection, when I set up the input.yaml as specified on the wiki page I get error during instrumentation complaining about the format of input.yaml.

I eventually got it the instrumentation to run without generating errors using the following configuration:
instSelMethod:
- custominstselector: llfiindex

   customInstSelector: llfiindex  
   customInstSelectorOption:
         - injecttoindex: 79      

However calling injectfault generate the following error:

Traceback (most recent call last):
  File "/Users/faateemahfika/Tools/llfi/build/bin/llfi", line 67, in <module>
    cmds[cmd].run(args)
 File "/Users/faateemahfika/Tools/llfi/build/bin/inject.py", line 410, in run
    fi_cycle = random.randint(0, int(totalcycles) - 1)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/random.py", line 216, in randint
    return self.randrange(a, b+1)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/random.py", line 194, in randrange
    raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)

Can anyone help me out?

-Fatimah

help in llfi

hi
After many attempts, I have not yet found the right way to install LLFI
I am very confused and very sad because after 3 days of reading and trying to install llfi (also llvm and another external packages), the terminal ansower was always (ERROR , ERROR , ERROR :( ) .
below is a picture which explains the problem

can you help me, please

Running ./setup for LLFI:
ERROR: You need to install Python Yaml module before building LLFI.

Please fix the above error(s) before building LLFI.

// I installed python and python yaml
but still the error appears .

with regards

Using llfiindex custom Fault Injection Instruction Selector

I have been using the following input.yaml compile configuration with a much older LLFI build and it was working great.

instSelMethod: 
      - custominstselector: llfiindex

customInstSelector: llfiindex  
customInstSelectorOption:
     - -injecttoindex=114
     - -injecttoindex=1
     - -injecttoindex=53
     - -injecttoindex=85

Few days ago I build the latest version, and it seems the llfiindex instruction selector doesn't work as expected. I don't get any error but it just doesn't have any effect. The fi_index selected is not restricted to those given in customInstSelectorOption.

Thanks in advance,
Fatimah

Profiling file not generated

I found a case when I was running llfi. This is the generated profiling IR:

%178 = landingpad { i8_, i32 } personality i8_ bitcast (i32 (...)* @gxx_personality_v0 to i8)
catch i8
null, !llfi_index !15416
call void @doProfiling(i32 59)
%179 = extractvalue { i8_, i32 } %178, 0, !llfi_index !15417
call void @doProfiling(i32 57)
call void @_clang_call_terminate(i8 %179) #11, !llfi_index !15418
call void @endProfiling()
unreachable, !llfi_index !15419

I am not sure this endProfiling function would be called. This has something to do with the exception handling in c++. I think endProfiling should be added before that terminate call.

Trace files not always generated

After fault injection, there are some cases where not all the runs have trace files generated.

For some of the runs, the program may crash before outputting trace files. And whether the trace files is generated or not is random. We may not be able to reproduce the same result every time we run fault injection.

Instrument problem when trying "water-nsquared"

Program: water-nsquared, from SPLASH-2
Optimization level: O2
Compiler: llvm-gcc 4.2.2
Linker: llvm-ld

Input: Default input provided in SPLASH-2
Run in One thread mode

Problem:
When doing instrument, follow assertion triggerd:
Assertion isa(ret) && "Last instruction is not return instruction" failed.
Location: llvm_passes/Utils.cpp:16:llvm::Instruction* llfi:getTermInstofFunction(llvm::Function*)

Instruction.def is not up-to-date

Hi all,

I encountered a error message when I was running pathfinder from Rodinia benchmark suite. it says no such opcode in Instruction.def. I then realize that the Instruction.def is for 2.9 not for 3.3 In LLVM 3.3 there are 58 instructions but only 54 in LLVM 2.9. I am thinking of a more elegant way to solve it instead of hard copying that file between LLVM versions.

when I try to inject data corruption fault,there is a error

1 ,we compile a number of .c file to .bc separately
2 We link all the .bc files to a big .bc file .
3 We execute the instrument script to inject fault ,but there is no compile parameter to include head file.
When we use gcc, we must use compile parameter to include head file. gcc main.c -lm -I ./Test/include -L ./Test/lib -lmyfac -o a.out

I notice that this error happens when I try to inject data corruption fault. While I manage to inject “NoOutput(API)” fault, no error observed. I guess the tested program use some variable type not supported by LLFI yet.

LLFI Installation error

hi for all,
I read the information about how we can install LLFI automatically and carried out the installation instruction strictly. unfortunately, for more than five attempts, error still appears. here are some information about my system and what I did :
1- my OS is Linux Ubuntu 15.04 32bit
2- first, I've installed all dependencies (Cmake, Python, JDK, tcsh,) (cmake and tcsh installed them from Ubuntu software enter)
3- when I launched the InstallLLFI.py file ... all things had been done correctly

Inline image 1
image

Inline image 2
image

Inline image 3
image

Inline image 4

image

about 2 hour ...
this error occurred
image

Inline image 5

which Python Yaml module, LLFI request me to install it ?
I installed yaml which founded in the same folder : (pyyamlsrc)

Inline image 6
image

and repeated the attempt but error still appeared.
I went to Ubuntu software center and installed :
YAML parser and emitter for Python &
YAML parser and emitter for Python (debug build)

please, any help will make me happy
Alhaj
with regards

Profiling and Injection scripts hang on large outputs

I don't know if this is specific to OS X, but when I use the profiling/injection scripts on programs that output a lot of text on stdout, the python script tends to hang.

The following (rather silly) program is one way to trigger this issue on my computer:

include<stdio.h>
#define NUM_ITER 100000

int main(){
        int i,j;
        for (i = 0; i < NUM_ITER; i++){
                for(j = 0; j < 10; j++){
                        printf("aaaaaaaa");
                }
                printf("\n"); //80 chars per line + newline
        }
        printf("I AM FINISHED NOW\n");
        return 0;
}

It simply prints 80 characters per line for 100,000 lines, then exits. When run in the terminal, the profiling executable exits in under 5 seconds. When run in the profiling/injection script, it hangs and never exits.


Some poking around leads me to believe that the reason this is occurring is because the program fills up the PIPE to stdout (I think the warning in that documentation applies to both wait() and poll()).

Since the script doesn't read from the pipe until after the program exits, the whole thing deadlocks: the program is waiting for the stdout buffer to be emptied so that it can continue, and the script waiting for the program to exit so that it can empty the stdout buffer.

I've created a simple fix that involves reading the lines as they come in to stdout. This works, but I don't know what the performance costs are, how it affects the timeout duration, or whether it breaks other programs, since I've only tested it on 2 at the time of writing.

EDIT: This "patch" completely breaks the timeout mechanism.


Replacement section of execute() function for profile.py that does not block
def execute(execlist):
  #print "Begin"
  #inputFile = open(inputfile, "r")
  global outputfile
  print('\t' + ' '.join(execlist))
  #get state of directory
  dirSnapshot()
  p = subprocess.Popen(execlist, stdout=subprocess.PIPE)
  elapsetime = 0
  lines = [] #Append lines to a list in memory instead
  while True:
    elapsetime += 1
    ### NEW CODE ###
    # If the program isn't done, read all of the stdout it's generated since the last
    # sleep() call and store it in lines. Empties the stdout buffer before sleeping again.
    for line in iter(p.stdout.readline, b''): #Grab all non-empty lines in stdout
      lines.append(line.decode().rstrip()) #strip trailing whitespace and store
    ###
    time.sleep(1)
    if p.poll() is not None:
      moveOutput()
      print("\t program finish", p.returncode)
      print("\t time taken", elapsetime,"\n")
      outputFile = open(outputfile, "wb")
      ### NEW CODE  ###
      for line in lines:
        outputFile.write(bytes("%s\n" % line, 'UTF-8')) #write stored lines to file
      ###
      outputFile.close()
      replenishInput() #for cases where program deletes input or alters them each run
      #inputFile.close()
      return p.returncode

linker command failed with exit code 1 during instrument pass

When I instrument this IR file using current LLFI version, it gives


/usr/bin/ld: h_errno: TLS definition in /lib/x86_64-linux-gnu/libc.so.6 section .tbss mismatches non-TLS reference in /home/anthony/Downloads/test_justin/llfi/showdbctl_final-profiling.o
/lib/x86_64-linux-gnu/libc.so.6: error adding symbols: Bad value
clang-3.4: error: linker command failed with exit code 1 (use -v to see invocation)

ERROR: there was an error during linking and generating executables,Please take /home/anthony/Downloads/test_justin/llfi/showdbctl_final-profiling.ll and /home/anthony/Downloads/test_justin/llfi/showdbctl_final-faultinjection.ll and generate the executables manually (linking llfi-rt in directory /home/anthony/llfi-merge/bin/../runtime_lib)


The IR under test is compiled from https://github.com/CMU-Quake/hercules

Contact me to get compiled IR file as I can not upload files here.

It seems all the injection isn't done correctly,what's wrong with it

gandalf@SZX1000074727:/mnt/llfi20160324/llfi/test_suite/SCRIPTS$ python3 inject_prog.py 1 insttype
ERROR: instrument failed for: /mnt/llfi20160324/llfi/test_suite/HardwareFaults/insttype MCF.ll
ERROR: Skip: ./HardwareFaults/insttype
gandalf@SZX1000074727:/mnt/llfi20160324/llfi/test_suite/SCRIPTS$ python3 check_injection.py
=============== Result ===============
./SoftwareFaults/DataCorruption_Data FAIL: No ./llfi folder found!
./SoftwareFaults/MemoryLeak_Res FAIL: No ./llfi folder found!
./SoftwareFaults/InvalidSender_MPI FAIL: No ./llfi folder found!
./BatchMode/NoOpen_API_WrongMode_API_BufferUnderflow_API Subdirectories for failure modes not found!
./SoftwareFaults/BufferOverflowMalloc_Data FAIL: No ./llfi folder found!
./SoftwareFaults/NoClose_API FAIL: No ./llfi folder found!
./SoftwareFaults/BufferUnderflow_API FAIL: No ./llfi folder found!
./SoftwareFaults/NoDrain_MPI FAIL: No ./llfi folder found!
./SoftwareFaults/NoAck_MPI FAIL: No ./llfi folder found!
./SoftwareFaults/WrongSavedFormat_IO FAIL: No ./llfi folder found!
./HardwareFaults/funcname FAIL: No ./llfi folder found!
./SoftwareFaults/WrongSource_Data FAIL: No ./llfi folder found!
./SoftwareFaults/InappropriateClose_API FAIL: No ./llfi folder found!
./SoftwareFaults/WrongMode_API FAIL: No ./llfi folder found!
./HardwareFaults/insttype FAIL: No ./llfi folder found!
./SoftwareFaults/CPUHog_Res FAIL: No ./llfi folder found!
./SoftwareFaults/IncorrectOutput_Data FAIL: No ./llfi folder found!
./SoftwareFaults/PacketStorm_MPI FAIL: No ./llfi folder found!
./SoftwareFaults/NoMessage_MPI FAIL: No ./llfi folder found!
./SoftwareFaults/WrongPointer_Data FAIL: No ./llfi folder found!
./SoftwareFaults/BufferOverflow_API FAIL: No ./llfi folder found!
./SoftwareFaults/MemoryExhaustion_Res FAIL: No ./llfi folder found!
./SoftwareFaults/NoOutput_API FAIL: No ./llfi folder found!
./SoftwareFaults/RaceCondition_Timing FAIL: No ./llfi folder found!
./SoftwareFaults/UnderAccumulator_Res FAIL: No ./llfi folder found!
./SoftwareFaults/IncorrectOutput_API FAIL: No ./llfi folder found!
./SoftwareFaults/NoOutput_Data FAIL: No ./llfi folder found!
./HardwareFaults/llfiindex FAIL: No ./llfi folder found!
./HardwareFaults/multiplebits FAIL: No ./llfi folder found!
./SoftwareFaults/WrongDestination_Data FAIL: No ./llfi folder found!
./SoftwareFaults/NoOpen_API FAIL: No ./llfi folder found!
./SoftwareFaults/InvalidMessage_MPI FAIL: No ./llfi folder found!
./SoftwareFaults/HighFrequentEvent_Timing FAIL: No ./llfi folder found!
./SoftwareFaults/ThreadKiller_Res FAIL: No ./llfi folder found!
./BatchMode/SoftwareFailureAutoScan Subdirectories for failure modes not found!
./SoftwareFaults/InvalidPointer_Res FAIL: No ./llfi folder found!
./SoftwareFaults/BufferOverflowMemmove_Data FAIL: No ./llfi folder found!
./HardwareFaults/tracing FAIL: No ./llfi folder found!
./SoftwareFaults/LowMemory_Res FAIL: No ./llfi folder found!
./HardwareFaults/random FAIL: No ./llfi folder found!
./SoftwareFaults/Deadlock_Res FAIL: No ./llfi folder found!
./SoftwareFaults/WrongRetrievedFormat_IO FAIL: No ./llfi folder found!
./SoftwareFaults/StalePointer_Res FAIL: No ./llfi folder found!
./SoftwareFaults/WrongAPI_API FAIL: No ./llfi folder found!
./SoftwareFaults/WrongRetrievedAddress_IO FAIL: No ./llfi folder found!
./SoftwareFaults/WrongSavedAddress_IO FAIL: No ./llfi folder found!
gandalf@SZX1000074727:/mnt/llfi20160324/llfi/test_suite/SCRIPTS$

can I use LLFI to inject CFE (control-flow error) into the code

CFE control-flow error is a violation program's control during run-time
llfi is a fault injection tool , but can llfi make a control- flow error , or not ,
like modify the value of stack pointer or (%eip instruction pointer register) and how, or not.
thanks

Cannot take the address of an intrinsic!

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)), !llfi_injectfault !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:
0. 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

  1. Running pass 'Function Pass Manager' on module '/ubc/ece/home/kp/grads/behsan/Workload/LLFI_Build/SampleTest/stringsearch/llfi/stringsearch-llfi_index.ll'.
  2. Running pass 'Module Verifier' on function '@main'

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

If i have finish the installing?because at the end of trace,it's no successful prompt

Scanning dependencies of target test_suite-SCRIPTS
[ 72%] Generating build_prog.py
[ 72%] Generating check_injection.py
[ 73%] Generating clean_prog.py
[ 74%] Generating clear_all.py
[ 74%] Generating clear_llfi.py
[ 75%] Generating deploy_prog.py
[ 76%] Generating inject_prog.py
[ 77%] Generating test_trace_tools.py
[ 77%] Generating llfi_test
[ 78%] Generating test_generate_makefile.py
[ 78%] Built target test_suite-SCRIPTS
Scanning dependencies of target gui
[ 79%] Generating application/ClosePopupController.class
[ 79%] Generating application/CompileToIrController.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 80%] Generating application/FaultInjectionController.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 80%] Generating application/Main.class
[ 81%] Generating application/MyThread.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 82%] Generating application/ProfilingController.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 82%] Generating application/ProgressBarController.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 83%] Generating application/SaveProfileController.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 83%] Generating application/TraceController.class
×¢: /mnt/llfi/llfisrc/gui/application/Controller.javaʹÓÃÁËδ¾­¼ì²é»ò²»°²È«µÄ²Ù×÷¡£
×¢: ÓйØÏêϸÐÅÏ¢, ÇëʹÓà -Xlint:unchecked ÖØбàÒë¡£
[ 84%] Generating application/TraceOpenError.fxml
[ 84%] Generating application/TracingErrorDisplay.fxml
[ 85%] Generating application/compileToIR.fxml
[ 86%] Generating application/Config.fxml
[ 86%] Generating application/ErrorDisplay.fxml
[ 87%] Generating application/InjectFaultResult.fxml
[ 88%] Generating application/Instrument.fxml
[ 89%] Generating application/NextRunOptionPopup.fxml
[ 89%] Generating application/Profile.fxml
[ 90%] Generating application/ProfileName.fxml
[ 91%] Generating application/ProfileWithInput.fxml
[ 91%] Generating application/Profiling.fxml
[ 92%] Generating application/ProgressWindow.fxml
[ 93%] Generating application/Sample.fxml
[ 94%] Generating gui_config.yaml
[ 94%] Generating application/lib/snakeyaml-1.15.jar
[100%] Built target gui
running install
running build
running build_py
copying lib3/yaml/serializer.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/reader.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/composer.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/representer.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/loader.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/nodes.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/init.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/constructor.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/error.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/resolver.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/cyaml.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/events.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/parser.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/dumper.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/tokens.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/emitter.py -> build/lib.linux-x86_64-3.2/yaml
copying lib3/yaml/scanner.py -> build/lib.linux-x86_64-3.2/yaml
running build_ext
running install_lib
creating /mnt/llfi/pyyaml
creating /mnt/llfi/pyyaml/lib
creating /mnt/llfi/pyyaml/lib/python3.2
creating /mnt/llfi/pyyaml/lib/python3.2/site-packages
creating /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/serializer.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/reader.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/composer.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/representer.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/loader.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/nodes.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/init.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/constructor.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/error.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/resolver.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/cyaml.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/events.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/parser.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/dumper.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/tokens.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/emitter.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
copying build/lib.linux-x86_64-3.2/yaml/scanner.py -> /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/serializer.py to serializer.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/reader.py to reader.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/composer.py to composer.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/representer.py to representer.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/loader.py to loader.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/nodes.py to nodes.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/init.py to init.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/constructor.py to constructor.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/error.py to error.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/resolver.py to resolver.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/cyaml.py to cyaml.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/events.py to events.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/parser.py to parser.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/dumper.py to dumper.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/tokens.py to tokens.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/emitter.py to emitter.cpython-32.pyc
byte-compiling /mnt/llfi/pyyaml/lib/python3.2/site-packages/yaml/scanner.py to scanner.cpython-32.pyc
running install_egg_info
Writing /mnt/llfi/pyyaml/lib/python3.2/site-packages/PyYAML-3.11-py3.2.egg-info
root@SZX1000074727:/mnt/llfi# ll

traceontograph crash

I've encountered this while using tools/traceontograph:

> $LLFI/tools/traceontograph diff.trace llfi_out/llfi.stat.graph.dot 
Traceback (most recent call last):
  File "<>/tools/traceontograph", line 64, in <module>
    traceOntoGraph(sys.argv[1], sys.argv[2])
  File "<>/tools/traceontograph", line 35, in traceOntoGraph
    affectedEdges = rep.getAffectedEdgesSet()
  File "<>/tools/tracetools.py", line 458, in getAffectedEdgesSet
    affectedEdges.add((edgeStart, edgeEnd))
UnboundLocalError: local variable 'edgeEnd' referenced before assignment

Here is how I'm generating the files:

> tracediff baseline/llfi.stat.trace.prof.txt llfi_stat_output/llfi.stat.trace.0-0.txt > diff.trace
> traceontograph diff.trace llfi_out/llfi.stat.graph.dot 

I've reproduced this with my own programs and also the factorial test program.

About Python version

Looks like, LLFI only support Python higher than 3. I try to use Python 2.7, but import yaml in python script constantly goes wrong. Everything goes find after I switch version of python to 3.2. Maybe the case.

SDCs are misreported

Sometimes even when no fault is injected, the results displayed in the GUI indicate there is an SDC. This is likely because the environment variable for the output comparison script is not being checked correctly.

This is high priority and needs to be fixed asap. Thanks,

  • Karthik

Content of the "llfi.stat.fi.injectedfaults" file is wrong when both "fi_num_bits" and "window_len" are specified in the input.yaml file.

In case both "fi_num_bits" and "window_len" are specified in the input.yaml file, except the first injection, all other injections have the same fi_cycle in the "llfi.stat.fi.injectedfaults" file, which should not be the case.
For example if fi_num_bits = 4 and window_len = 10, LLFI should perform 8 injections, four of them should be injected into the first register in a specific fi_cycle and the other four into the second register in a specific fi_cycle. However, the fi_cycles that are traced in the llfi.stat.fi.injectedfaults are all the same from the second injection onwards.

"fi_num_bits" is used to specify the number of bits to flip for one faulty register.
"window_len" is used to specify the maximum number of dynamic instances between TWO consecutive faults.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.