# 故障注入

故障注入是一种测试技术，它有意向硬件或软件系统引入故障，观察系统如何响应，从而测量或验证其可信性。它用于测量分析式可信性模型的参数、验证既有容错系统，并综合新的容错设计。<sup>[1](https://dl.acm.org/doi/10.1109/2.386985)</sup> 该技术由受控实验组成：在这些实验中，通过显式注入故障来诱发系统在故障存在时的行为，并加以观察。<sup>[2](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)</sup> 它的产出不是单一制品：一轮注入活动会给出每个注入故障的分类结果、对错误检测与恢复行为的估计，以及可靠性模型的定量输入。

| 方面 | 关键事实 |
|---|---|
| 目的 | 测量可信性模型参数、验证容错系统、综合容错设计<sup>[1](https://dl.acm.org/doi/10.1109/2.386985)</sup> |
| 技术类别 | 硬件实现、软件实现（SWIFI）和基于仿真的注入<sup>[2](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)</sup><sup> • </sup><sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup> |
| 表征维度 | 可重复性、可控性、侵入性、结果可观测性和故障位置可达性<sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup> |
| 结果类别 | 良性、静默数据损坏（silent data corruption，SDC）或崩溃/挂起，依据基准运行判定<sup>[4](https://link.springer.com/article/10.1007/s10836-025-06170-w)</sup> |
| 经典指标 | 错误/故障比、性能退化、系统崩溃次数<sup>[5](https://link.springer.com/chapter/10.1007/BFb0024305)</sup> |
| 标准用途 | 支持 ISO 26262（功能安全）和 ISO/SAE 21434（汽车网络安全）下的合规工作<sup>[6](https://www.mdpi.com/2410-387X/9/3/54)</sup> |
| 最大未决问题 | 所注入故障的代表性<sup>[7](https://users.ece.cmu.edu/~koopman/ballista/dsn2002/wdb02_preprint.pdf)</sup> |

## 工作原理

一轮注入活动建立在一个故障模型之上，即对什么被破坏的形式化描述。常见模型包括单比特和多比特翻转、固定为 0 和固定为 1、置位和复位、持续一个或多个时钟周期的瞬态故障，以及永久性固定故障行为。<sup>[8](https://arxiv.org/html/2602.02119)</sup><sup> • </sup><sup>[9](https://www.ihp-microelectronics.com/php_scripts/publications/full_text_final_files/petryk-petryk-ieee-trans-on-dev-and-mater-reliabil-25-410-2025_1-2025.pdf)</sup> 触发机制决定故障何时进入正常执行：触发器分为基于时间、基于位置或基于执行驱动；注入可以发生在运行前、运行时或加载时；触发可以是同步的（如异常处理），也可以是异步的（如硬件中断）。<sup>[10](https://www.intechopen.com/chapters/56668)</sup>

每个实验都将故障行为与无故障参考进行比较。偏离基准运行中记录的预期序列的情况会决定结果分类：输出一致为良性，输出错误为静默数据损坏，超时则为崩溃或挂起。<sup>[4](https://link.springer.com/article/10.1007/s10836-025-06170-w)</sup> 评判技术时考察可重复性（同一故障给出同一结果）、可控性（何时何地注入）、侵入性（对目标的影响）、结果可观测性和故障位置可达性。<sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup>

## 实施方法

典型的注入活动按如下步骤进行。首先，固定故障模型和故障空间，例如存储器、寄存器和指令指针中单比特翻转的所有时间-位置对。其次，进行一次无故障的基准运行，记录正常行为。第三，选择注入点；FAIL* 框架通过写读等价类施加运行剖面剪枝或定义/使用剪枝，以减少在百分之百覆盖故障空间坐标时所需的实验数量，同时仍能识别关键软件位置。<sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup> 第四，注入故障并监视系统。第五，对结果分类，并汇总为良性、SDC 和崩溃结果的比例。

生产系统直接提供这些控制。[Linux 内核](https://www.edgepedia.org/zh/linux-kernel)的故障注入基础设施提供 failslab、fail_page_alloc、fail_usercopy、fail_futex、fail_sunrpc、用于磁盘 I/O 错误的 fail_make_request、fail_mmc_request、fail_function、NVMe 故障注入和空块注入，通过 debugfs 条目配置概率、失败间隔、最大次数、资源预算和地址范围过滤器；/proc/<pid>/fail-nth 机制使任务中的第 N 次调用失败，以便进行系统化的系统调用测试。<sup>[11](https://www.kernel.org/doc/html/v6.9/fault-injection/fault-injection.html)</sup>

## 起源

一个软件实现的故障插入模型曾在 FTMP 容错计算机上提出，用于模拟处理器数据通路、控制通路、系统存储器和发送总线中的故障。在同一台机器上比较软件插入故障与引脚级硬件插入实验，发现检测时间上没有相关性，因为硬件插入的故障必须先表现为错误才能被检测，而软件插入的故障会立即触发错误检测机制；由此得出结论：软件插入不能完全模拟硬件插入，但更简便、更易自动化、更具可重复性和可控性。<sup>[12](https://ntrs.nasa.gov/api/citations/19880005286/downloads/19880005286.pdf)</sup> 可信性验证方法学由 J. 阿尔拉（J. Arlat）及其同事在 1990 年发表于《IEEE Transactions on Software Engineering》的论文中形式化，并在引脚级工具 MESSALINE 中实现，还在铁路联锁子系统和 Delta-4 通信系统上进行了演示。<sup>[13](https://doi.org/10.1109/32.44380)</sup>

具名工具的谱系很快随之出现。FIAT 是一个自动化实时分布式故障注入环境。<sup>[14](https://doi.org/10.1109/12.54853)</sup><sup> • </sup><sup>[2](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)</sup> FERRARI 由 G. A. 卡纳瓦蒂（G. A. Kanawati）、N. A. 卡纳瓦蒂（N. A. Kanawati）和 J. A. 亚伯拉罕（J. A. Abraham）提出（《IEEE Transactions on Computers》，1995 年），使用软件陷阱注入 CPU、存储器和总线故障。<sup>[15](https://doi.org/10.1109/12.364536)</sup><sup> • </sup><sup>[2](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)</sup> FTAPE 由蒂莫西·蔡（Timothy Tsai）和拉维尚卡尔·K. 艾耶（Ravishankar K. Iyer）提出，组合了全系统故障注入器、工作负载生成器和工作负载活动测量工具。<sup>[5](https://link.springer.com/chapter/10.1007/BFb0024305)</sup> NFTAPE 利用轻量级故障注入器、触发器和监视器来组合实验，其动机是观察到没有单一工具能注入所有必要的故障模型，而且工具难以移植。<sup>[16](https://doi.org/10.1109/ipds.2000.839467)</sup> 基于仿真的注入随后体现在 DEPEND 中——这是 K. K. 戈斯瓦米（K. K. Goswami）提出的系统级可信性分析环境（《IEEE Transactions on Computers》，1997 年）<sup>[17](https://doi.org/10.1109/12.559803)</sup>——也体现在 MEFISTO 中，后者向 VHDL 模型注入故障（埃里克·詹恩（Eric Jenn）及其同事，1995 年）。<sup>[18](https://doi.org/10.1007/978-3-642-79789-7_19)</sup> 在云运维中，奈飞（Netflix）的 Chaos Monkey 最初是 Simian Army 套件的一部分；该项目退役并归档后，Chaos Monkey 被拆分出来，成为一个使单节点 AWS 实例不可用的独立工具。<sup>[10](https://www.intechopen.com/chapters/56668)</sup>

## 变体

**运行时 SWIFI** 向目标添加软件，由异常或 CPU 调试特性触发，并向运行中的系统注入故障；例子包括 FIAT、FERRARI、Xception 和 GOOFI-2。<sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup> FERRARI 修改可执行映像，使执行修改后的代码能复现内部硬件故障的行为；它构建在公有领域的 GNU 工具之上，并首先在 SPARC 工作站上实现。<sup>[19](https://www.cerc.utexas.edu/~jaa/ftc/fault-injection.html)</sup>

**硬件实现的注入** 包括重离子辐射、电源扰动、引脚级探针（如 RIFLE 和 MESSALINE），以及通过 Nexus 或 JTAG 等处理器调试接口进行硬件辅助软件注入（如 Xception 和 GOOFI-2），这与辐射或引脚级故障注入等物理注入不同。<sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup> 基于辐射的注入活动对故障落在何处、何时发生可控性很低，不能确定性地重复，而且在金钱和时间上极其昂贵。<sup>[20](https://ess.cs.uni-osnabrueck.de/static/papers/Schirmeier-2015-DSN.pdf)</sup>

**基于仿真的注入** 在模拟器或仿真器中运行设计。仿真寄存器传输级描述比实际电路运行慢多个数量级，因此只能评估较短的故障传播区间。<sup>[2](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)</sup> FAIL* 支持三种模拟器后端：Bochs、gem5 和 [QEMU](https://www.edgepedia.org/zh/qemu)，选择它们是因为注入后分析所需的重现性和可控性。<sup>[3](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)</sup> 近期工作趋向于结合硬件和软件技术的混合注入，通常由 FPGA 技术实现。<sup>[2](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)</sup>

物理注入也是密码系统故障攻击的标准手段。激光故障注入自 20 世纪 80 年代末起被使用；它属于半侵入式，需要芯片开盖，而且很难稳定地只获得单单元翻转，因为多单元翻转占主导。<sup>[21](https://re.public.polimi.it/retrieve/26f6ef3b-d49f-430c-ae70-fdf0af989006/laser-final.pdf)</sup> 在一款 CMOS 28 nm AES-128 测试芯片上，以 5 微米光斑和 10 纳秒脉冲进行背面注入，从 26,380 个发生故障的密文中识别出 19,806 个单字节故障，表明单比特和置位/复位模型在该工艺节点上仍然实用。<sup>[22](https://fdtc.deib.polimi.it/FDTC18/shared/FDTC%202018%20-%20session%201.1.pdf)</sup> 张帆（Fan Zhang）及其同事在 2018 年描述的持久性故障分析，通过一系列 1,000 次激光照射使密码的 S 盒发生故障，从而只需 3,000 个密文即可完成攻击。<sup>[23](https://doi.org/10.46586/tches.v2018.i3.150-172)</sup><sup> • </sup><sup>[24](https://tches.iacr.org/index.php/TCHES/article/download/11798/11303/12819)</sup>

## 应用

在安全关键领域，故障注入支持符合 [ISO 26262](https://www.edgepedia.org/zh/iso-26262) 功能安全和 [ISO/SAE 21434](https://www.edgepedia.org/zh/iso-sae-21434) 汽车网络安全的合规要求。<sup>[6](https://www.mdpi.com/2410-387X/9/3/54)</sup> 相关框架将结果映射到可靠性指标，如架构脆弱性因子（Architectural Vulnerability Factor，AVF）和软错误率（Soft Error Rate，SER），并映射到 ISO 26262 所要求的失效模式与影响分析（Failure Mode and Effects Analysis，FMEA）。<sup>[25](https://iris.polito.it/retrieve/d94397c4-4e8d-4b70-afda-b72d1884daf0/SHADOWFI_An_Open-Source_Framework_for_Fault_Evaluation_of_Complex_IC_Designs_Using_Hyperscale_Computing.pdf)</sup>

在云系统中，AWS 故障注入服务（AWS Fault Injection Service）从模板运行实验，模板包含操作、目标和停止条件，停止条件与亚马逊 CloudWatch（Amazon CloudWatch）告警关联，在达到阈值时中止实验。<sup>[26](https://docs.aws.amazon.com/fis/latest/userguide/what-is.html)</sup> 报告的指标因场景而异：FTAPE 报告了基于压力的注入下的错误/故障比、性能退化和系统崩溃次数，<sup>[5](https://link.springer.com/chapter/10.1007/BFb0024305)</sup> 分布式系统工具报告容错逻辑的覆盖情况（CAFault 的覆盖比 CrashFuzz、Mallory 和 Chronos 分别多 31.5%、29.3% 和 81.5%，并发现 16 个此前未知的严重缺陷），<sup>[27](https://www.usenix.org/system/files/atc25-chen-yuanliang.pdf)</sup> 安全工具报告统计置信度，其中 FIESTA 在 53,695 秒内以 0.999999 的置信水平评估了 1,714 个位置上的 394,220 个故障。<sup>[28](https://artifacts.iacr.org/tches/2025/a44/readme.html)</sup> 在一块运行 FreeRTOS 的赛灵思（Xilinx）PYNQ Z2 开发板上，一个调试接口框架测得，存储器注入的结果为 99.8% 良性和 0.2% 崩溃，而寄存器注入为 96.9% 良性和 3.1% 崩溃；多比特注入则显著提高 SDC 和崩溃率。<sup>[4](https://link.springer.com/article/10.1007/s10836-025-06170-w)</sup>

## 局限与替代方案

所注入故障的代表性可以说是故障注入中最大的未决问题。<sup>[7](https://users.ece.cmu.edu/~koopman/ballista/dsn2002/wdb02_preprint.pdf)</sup> 将直接故障注入用作可信性基准，会犯“否定前件”的逻辑谬误：故障注入表现差并不能证明软件不可信。<sup>[7](https://users.ece.cmu.edu/~koopman/ballista/dsn2002/wdb02_preprint.pdf)</sup> 指标选择可能使比较失效：广泛使用的故障覆盖率百分比不足以比较基准变体，因为加固变体具有不同的故障空间大小；在一个例子中，该指标完全掩盖了一个加固变体（SYNC2）相比其基线恶化了五倍以上。<sup>[20](https://ess.cs.uni-osnabrueck.de/static/papers/Schirmeier-2015-DSN.pdf)</sup> 一项系统研究考察了激活故障是否与用户设计的故障模型相符，审视了有限覆盖、程序部分执行不均以及工作负载性质所带来的偏差。

SWIFI 无法捕捉硬件故障的全部后果，因为它在软件层面进行抽象；DMA 传输上的任何故障都无法捕捉，而且插桩会造成执行开销，影响速度和内存消耗。<sup>[29](https://inria.hal.science/hal-01950931/file/fps18.pdf)</sup> 注入同一错误的结果在基于测试端口、基于异常和基于插桩的技术之间可能不同，主要由于测量不确定性，而初始化不确定性会显著影响结果。<sup>[30](https://eden.dei.uc.pt/~rbarbosa/files/EDCC2010-ComparingDependabilityMeasurements.pdf)</sup> 硬件注入中常见的“一次一个故障”假设对于协同效应无处不在的软件系统并不现实，而且该技术在安全关键和嵌入式领域之外尚未广泛使用。<sup>[10](https://www.intechopen.com/chapters/56668)</sup> 变异分析是一种软件测试方法，属于相关但不同的技术；一项比较研究提出用变异分析评估软件层面针对硬件故障的可靠性，并指出约 10% 的软件失效是由纯硬件故障传播到软件层造成的。<sup>[31](https://www.sciencedirect.com/science/article/abs/pii/S0141933116302575)</sup> 最后，故障空间随规模爆炸：在 ResNet-20 上评估 CIFAR-10 需要超过 1,700 万次仿真，折算为数月的运行时间。<sup>[32](https://doi.org/10.1109/vts69484.2026.11563206)</sup>

## References

1. [Fault Injection: A Method for Validating Computer-System Dependability (Clark & Pradhan, IEEE Computer, 1995)](https://dl.acm.org/doi/10.1109/2.386985)
2. [A Survey on Fault Injection Techniques (International Arab Journal of Information Technology)](https://www.ccis2k.org/iajit/PDF/vol.1,no.2/04-Hissam.pdf)
3. [FAIL*: An Open and Versatile Fault-Injection Framework for the Assessment of Software-Implemented Hardware Fault Tolerance (EDCC 2015)](https://ess.cs.uos.de/danceos/publications/EDCC-2015-Schirmeier.pdf)
4. [Real-time Embedded System Fault Injector Framework for Micro-architectural State Based Reliability Assessment (Journal of Electronic Testing, 2025)](https://link.springer.com/article/10.1007/s10836-025-06170-w)
5. [Measuring Fault Tolerance with the FTAPE fault injection tool (Tsai & Iyer, TOOLS 1995, LNCS 977)](https://link.springer.com/chapter/10.1007/BFb0024305)
6. [Reliability of LEON3 Processor's Program Counter Against SEU, MBU, and SET Fault Injection (Cryptography, 2025)](https://www.mdpi.com/2410-387X/9/3/54)
7. [What's Wrong With Fault Injection As A Benchmarking Tool? (Koopman, Workshop on Dependability Benchmarking, 2002)](https://users.ece.cmu.edu/~koopman/ballista/dsn2002/wdb02_preprint.pdf)
8. [CHAOS: Controlled Hardware fAult injectOr System for gem5 (arXiv, 2026)](https://arxiv.org/html/2602.02119)
9. [Sensitivity of Logic Cells to Laser Fault Injections: An Overview of Experimental Results for IHP Technologies (IEEE Trans. Device and Materials Reliability, 2025)](https://www.ihp-microelectronics.com/php_scripts/publications/full_text_final_files/petryk-petryk-ieee-trans-on-dev-and-mater-reliabil-25-410-2025_1-2025.pdf)
10. [Software Fault Injection: A Practical Perspective (IntechOpen book chapter)](https://www.intechopen.com/chapters/56668)
11. [Fault injection capabilities infrastructure, The Linux Kernel documentation](https://www.kernel.org/doc/html/v6.9/fault-injection/fault-injection.html)
12. [Software Implemented Fault Insertion: An FTMP Example (NASA Contractor Report, 1987; also CMU-CS-87-101 / AFWAL-TR-87-1164)](https://ntrs.nasa.gov/api/citations/19880005286/downloads/19880005286.pdf)
13. [J. Arlat and colleagues (1990). Fault injection for dependability validation: a methodology and some applications. IEEE Transactions on Software Engineering.](https://doi.org/10.1109/32.44380)
14. [J.H. Barton and colleagues (1990). Fault injection experiments using FIAT. IEEE Transactions on Computers.](https://doi.org/10.1109/12.54853)
15. [G.A. Kanawati, N.A. Kanawati, J.A. Abraham (1995). FERRARI: a flexible software-based fault and error injection system. IEEE Transactions on Computers.](https://doi.org/10.1109/12.364536)
16. [NFTAPE: a framework for assessing dependability in distributed systems with lightweight fault injectors](https://doi.org/10.1109/ipds.2000.839467)
17. [K.K. Goswami (1997). DEPEND: a simulation-based environment for system level dependability analysis. IEEE Transactions on Computers.](https://doi.org/10.1109/12.559803)
18. [Eric Jenn and colleagues (1995). Fault Injection into VHDL Models: The MEFISTO Tool. .](https://doi.org/10.1007/978-3-642-79789-7_19)
19. [System evaluation using fault and error injection (UT Austin Computer Engineering Research Center)](https://www.cerc.utexas.edu/~jaa/ftc/fault-injection.html)
20. [Avoiding Pitfalls in Fault-Injection Based Comparison of Program Susceptibility to Soft Errors (DSN 2015)](https://ess.cs.uni-osnabrueck.de/static/papers/Schirmeier-2015-DSN.pdf)
21. [Laser Fault Injection Methodology for Software](https://re.public.polimi.it/retrieve/26f6ef3b-d49f-430c-ae70-fdf0af989006/laser-final.pdf)
22. [Laser Fault Injection at the CMOS 28 nm Technology Node: an Analysis of the Fault Model (FDTC 2018)](https://fdtc.deib.polimi.it/FDTC18/shared/FDTC%202018%20-%20session%201.1.pdf)
23. [Fan Zhang and colleagues (2018). Persistent Fault Analysis on Block Ciphers. IACR Transactions on Cryptographic Hardware and Embedded Systems.](https://doi.org/10.46586/tches.v2018.i3.150-172)
24. [Laser fault injection on unpowered devices (TCHES)](https://tches.iacr.org/index.php/TCHES/article/download/11798/11303/12819)
25. [SHADOWFI: An Open-Source Framework for Fault Evaluation of Complex IC Designs Using Hyperscale Computing](https://iris.polito.it/retrieve/d94397c4-4e8d-4b70-afda-b72d1884daf0/SHADOWFI_An_Open-Source_Framework_for_Fault_Evaluation_of_Complex_IC_Designs_Using_Hyperscale_Computing.pdf)
26. [What is AWS Fault Injection Service? (official documentation)](https://docs.aws.amazon.com/fis/latest/userguide/what-is.html)
27. [CAFault: Enhance Fault Injection Technique in Practical Distributed Systems via Abundant Fault-Dependent Configurations (USENIX ATC 2025)](https://www.usenix.org/system/files/atc25-chen-yuanliang.pdf)
28. [FIESTA, Fault Injection Evaluation with Statistical Analysis (TCHES 2025 artifact)](https://artifacts.iacr.org/tches/2025/a44/readme.html)
29. [Hardware fault injection and SWIFI shortcomings (FPS 2018, HAL preprint)](https://inria.hal.science/hal-01950931/file/fps18.pdf)
30. [Comparing and Validating Measurements of Dependability Attributes (EDCC 2010)](https://eden.dei.uc.pt/~rbarbosa/files/EDCC2010-ComparingDependabilityMeasurements.pdf)
31. [Computing reliability: On the differences between software testing and software fault injection techniques](https://www.sciencedirect.com/science/article/abs/pii/S0141933116302575)
32. [ENFOR-SA: End-to-end Cross-layer Transient Fault Injector for Efficient and Accurate DNN Reliability Assessment on Systolic Arrays (IEEE VTS 2026)](https://doi.org/10.1109/vts69484.2026.11563206)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Software engineering and development process › Software testing and quality

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/fault-injection

English original: https://www.edgepedia.org/fault-injection
