Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- include/winnt.h | 116 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+)
diff --git a/include/winnt.h b/include/winnt.h index c80efee077d..e80c10bd49c 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -915,6 +915,122 @@ NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ NTSYSAPI WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER);
+/* Fast fail (__fastfail) codes */ + +#define FAST_FAIL_LEGACY_GS_VIOLATION 0 +#define FAST_FAIL_VTGUARD_CHECK_FAILURE 1 +#define FAST_FAIL_STACK_COOKIE_CHECK_FAILURE 2 +#define FAST_FAIL_CORRUPT_LIST_ENTRY 3 +#define FAST_FAIL_INCORRECT_STACK 4 +#define FAST_FAIL_INVALID_ARG 5 +#define FAST_FAIL_GS_COOKIE_INIT 6 +#define FAST_FAIL_FATAL_APP_EXIT 7 +#define FAST_FAIL_RANGE_CHECK_FAILURE 8 +#define FAST_FAIL_UNSAFE_REGISTRY_ACCESS 9 +#define FAST_FAIL_GUARD_ICALL_CHECK_FAILURE 10 +#define FAST_FAIL_GUARD_WRITE_CHECK_FAILURE 11 +#define FAST_FAIL_INVALID_FIBER_SWITCH 12 +#define FAST_FAIL_INVALID_SET_OF_CONTEXT 13 +#define FAST_FAIL_INVALID_REFERENCE_COUNT 14 +#define FAST_FAIL_INVALID_JUMP_BUFFER 18 +#define FAST_FAIL_MRDATA_MODIFIED 19 +#define FAST_FAIL_CERTIFICATION_FAILURE 20 +#define FAST_FAIL_INVALID_EXCEPTION_CHAIN 21 +#define FAST_FAIL_CRYPTO_LIBRARY 22 +#define FAST_FAIL_INVALID_CALL_IN_DLL_CALLOUT 23 +#define FAST_FAIL_INVALID_IMAGE_BASE 24 +#define FAST_FAIL_DLOAD_PROTECTION_FAILURE 25 +#define FAST_FAIL_UNSAFE_EXTENSION_CALL 26 +#define FAST_FAIL_DEPRECATED_SERVICE_INVOKED 27 +#define FAST_FAIL_INVALID_BUFFER_ACCESS 28 +#define FAST_FAIL_INVALID_BALANCED_TREE 29 +#define FAST_FAIL_INVALID_NEXT_THREAD 30 +#define FAST_FAIL_GUARD_ICALL_CHECK_SUPPRESSED 31 +#define FAST_FAIL_APCS_DISABLED 32 +#define FAST_FAIL_INVALID_IDLE_STATE 33 +#define FAST_FAIL_MRDATA_PROTECTION_FAILURE 34 +#define FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION 35 +#define FAST_FAIL_INVALID_LOCK_STATE 36 +#define FAST_FAIL_GUARD_JUMPTABLE 37 +#define FAST_FAIL_INVALID_LONGJUMP_TARGET 38 +#define FAST_FAIL_INVALID_DISPATCH_CONTEXT 39 +#define FAST_FAIL_INVALID_THREAD 40 +#define FAST_FAIL_INVALID_SYSCALL_NUMBER 41 +#define FAST_FAIL_INVALID_FILE_OPERATION 42 +#define FAST_FAIL_LPAC_ACCESS_DENIED 43 +#define FAST_FAIL_GUARD_SS_FAILURE 44 +#define FAST_FAIL_LOADER_CONTINUITY_FAILURE 45 +#define FAST_FAIL_GUARD_EXPORT_SUPPRESSION_FAILURE 46 +#define FAST_FAIL_INVALID_CONTROL_STACK 47 +#define FAST_FAIL_SET_CONTEXT_DENIED 48 +#define FAST_FAIL_INVALID_IAT 49 +#define FAST_FAIL_HEAP_METADATA_CORRUPTION 50 +#define FAST_FAIL_PAYLOAD_RESTRICTION_VIOLATION 51 +#define FAST_FAIL_LOW_LABEL_ACCESS_DENIED 52 +#define FAST_FAIL_ENCLAVE_CALL_FAILURE 53 +#define FAST_FAIL_UNHANDLED_LSS_EXCEPTON 54 +#define FAST_FAIL_ADMINLESS_ACCESS_DENIED 55 +#define FAST_FAIL_UNEXPECTED_CALL 56 +#define FAST_FAIL_CONTROL_INVALID_RETURN_ADDRESS 57 +#define FAST_FAIL_UNEXPECTED_HOST_BEHAVIOR 58 +#define FAST_FAIL_FLAGS_CORRUPTION 59 +#define FAST_FAIL_VEH_CORRUPTION 60 +#define FAST_FAIL_ETW_CORRUPTION 61 +#define FAST_FAIL_RIO_ABORT 62 +#define FAST_FAIL_INVALID_PFN 63 +#define FAST_FAIL_GUARD_ICALL_CHECK_FAILURE_XFG 64 +#define FAST_FAIL_CAST_GUARD 65 +#define FAST_FAIL_HOST_VISIBILITY_CHANGE 66 +#define FAST_FAIL_KERNEL_CET_SHADOW_STACK_ASSIST 67 +#define FAST_FAIL_PATCH_CALLBACK_FAILED 68 +#define FAST_FAIL_NTDLL_PATCH_FAILED 69 +#define FAST_FAIL_INVALID_FLS_DATA 70 +#define FAST_FAIL_INVALID_FAST_FAIL_CODE 0xFFFFFFFF + +#if defined(__GNUC__) +#if defined(__x86_64__) +static FORCEINLINE DECLSPEC_NORETURN void __fastfail(unsigned int code) +{ + register ULONGLONG val __asm__("rcx") = code; + __asm__ __volatile__( "int $0x29" :: "r" (val) : "memory" ); +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))) + __builtin_unreachable(); +#endif +} +#elif defined(__i386__) +static FORCEINLINE DECLSPEC_NORETURN void __fastfail(unsigned int code) +{ + register ULONG val __asm__("ecx") = code; + __asm__ __volatile__( "int $0x29" :: "r" (val) : "memory" ); +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))) + __builtin_unreachable(); +#endif +} +#elif defined(__aarch64__) +static FORCEINLINE DECLSPEC_NORETURN void __fastfail(unsigned int code) +{ + register ULONGLONG val __asm__("x0") = code; + __asm__ __volatile__( "brk #0xf003" :: "r" (val) : "memory" ); +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))) + __builtin_unreachable(); +#endif +} +#elif defined(__arm__) +static FORCEINLINE DECLSPEC_NORETURN void __fastfail(unsigned int code) +{ + register ULONG val __asm__("r0") = code; + __asm__ __volatile__( "udf #0xfb" :: "r" (val) : "memory" ); +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))) + __builtin_unreachable(); +#endif +} +#endif /* __x86_64__ */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1610) +DECLSPEC_NORETURN void __fastfail(unsigned int); +#pragma intrinsic(__fastfail) +#endif /* __GNUC__ */ + + /* Heap flags */
#define HEAP_NO_SERIALIZE 0x00000001