Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

__fastfail

Feedback

In this article

Microsoft Specific

Immediately terminates the calling process with minimum overhead.

Syntax

__declspec(noreturn) void __fastfail(unsigned int code);

Parameters

code
[in] AFAST_FAIL_<description> symbolic constant from winnt.h or wdm.h that indicates the reason for process termination.

Return value

The__fastfail intrinsic does not return.

Remarks

The__fastfail intrinsic provides a mechanism for afast fail request—a way for a potentially corrupted process to request immediate process termination. Critical failures that may have corrupted program state and stack beyond recovery cannot be handled by the regular exception handling facility. Use__fastfail to terminate the process using minimal overhead.

Internally,__fastfail is implemented by using several architecture-specific mechanisms:

ArchitectureInstructionLocation of code argument
x86int 0x29ecx
x64int 0x29rcx
ARMOpcode 0xDEFBr0
ARM64Opcode 0xF003x0

A fast fail request is self-contained and typically requires just two instructions to execute. After a fast fail request has been executed, the kernel then takes the appropriate action. In user-mode code, there are no memory dependencies beyond the instruction pointer itself when a fast fail event is raised. That maximizes its reliability, even in cases of severe memory corruption.

Thecode argument, one of theFAST_FAIL_<description> symbolic constants from winnt.h or wdm.h, describes the type of failure condition. It's incorporated into failure reports in an environment-specific manner.

User-mode fast fail requests appear as a second chance non-continuable exception with exception code 0xC0000409, and with at least one exception parameter. The first exception parameter is thecode value. This exception code indicates to the Windows Error Reporting (WER) and debugging infrastructure that the process is corrupted, and that minimal in-process actions should be taken in response to the failure. Kernel-mode fast fail requests are implemented by using a dedicated bugcheck code,KERNEL_SECURITY_CHECK_FAILURE (0x139). In both cases, no exception handlers are invoked because the program is expected to be in a corrupted state. If a debugger is present, it's given an opportunity to examine the state of the program before termination.

Support for the native fast fail mechanism began in Windows 8. Windows operating systems that don't support the fast fail instruction natively will typically treat a fast fail request as an access violation, or as anUNEXPECTED_KERNEL_MODE_TRAP bugcheck. In these cases, the program is still terminated, but not necessarily as quickly.

__fastfail is only available as an intrinsic.

Requirements

IntrinsicArchitecture
__fastfailx86, x64, ARM, ARM64

Header file <intrin.h>

END Microsoft Specific

See also

Compiler intrinsics


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?