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
68 stars 35 forks source link

injectfault.py crashes when fi_bit is specified #5

Closed ShadenSmith closed 10 years ago

ShadenSmith commented 10 years ago

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)