v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
abort-mode.h
Go to the documentation of this file.
1
// Copyright 2023 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef V8_BASE_ABORT_MODE_H_
6
#define V8_BASE_ABORT_MODE_H_
7
8
// This file describes the way aborts are handled in OS::Abort and the way
9
// DCHECKs are working.
10
11
#include "
src/base/base-export.h
"
12
13
namespace
v8
{
14
namespace
base
{
15
16
enum class
AbortMode
{
17
// Used for example for fuzzing when controlled crashes are harmless, such
18
// as for example for the sandbox. With this:
19
// - DCHECKs are turned into No-ops and as such V8 is allowed to continue
20
// execution. This way, the fuzzer can progress past them.
21
// - CHECKs, FATAL, etc. are turned into regular exits, which allows fuzzers
22
// to ignore them, as they are harmless in this context.
23
// - The exit code will either be zero (signaling success) or non-zero
24
// (signaling failure). The former is for example used in tests in which a
25
// controlled crash counts as success (for example in sandbox regression
26
// tests), the latter is typically used for fuzzing where samples that exit
27
// in this way should be discarded and not mutated further.
28
kExitWithSuccessAndIgnoreDcheckFailures
,
29
kExitWithFailureAndIgnoreDcheckFailures
,
30
31
// DCHECKs, CHECKs, etc. use IMMEDIATE_CRASH() to signal abnormal program
32
// termination. See the --hard-abort flag for more details.
33
kImmediateCrash
,
34
35
// CHECKs, DCHECKs, etc. use abort() to signal abnormal program termination.
36
kDefault
37
};
38
39
V8_BASE_EXPORT
extern
AbortMode
g_abort_mode
;
40
41
V8_INLINE
bool
ControlledCrashesAreHarmless
() {
42
return
g_abort_mode
==
AbortMode::kExitWithSuccessAndIgnoreDcheckFailures
||
43
g_abort_mode
==
AbortMode::kExitWithFailureAndIgnoreDcheckFailures
;
44
}
45
46
V8_INLINE
bool
DcheckFailuresAreIgnored
() {
47
return
g_abort_mode
==
AbortMode::kExitWithSuccessAndIgnoreDcheckFailures
||
48
g_abort_mode
==
AbortMode::kExitWithFailureAndIgnoreDcheckFailures
;
49
}
50
51
}
// namespace base
52
}
// namespace v8
53
54
#endif
// V8_BASE_ABORT_MODE_H_
base-export.h
V8_BASE_EXPORT
#define V8_BASE_EXPORT
Definition
base-export.h:26
base
OpIndex base
Definition
instruction-selector-ia32.cc:65
v8::base::AbortMode
AbortMode
Definition
abort-mode.h:16
v8::base::AbortMode::kImmediateCrash
@ kImmediateCrash
v8::base::AbortMode::kDefault
@ kDefault
v8::base::AbortMode::kExitWithFailureAndIgnoreDcheckFailures
@ kExitWithFailureAndIgnoreDcheckFailures
v8::base::AbortMode::kExitWithSuccessAndIgnoreDcheckFailures
@ kExitWithSuccessAndIgnoreDcheckFailures
v8::base::g_abort_mode
AbortMode g_abort_mode
Definition
abort-mode.cc:10
v8::base::DcheckFailuresAreIgnored
V8_INLINE bool DcheckFailuresAreIgnored()
Definition
abort-mode.h:46
v8::base::ControlledCrashesAreHarmless
V8_INLINE bool ControlledCrashesAreHarmless()
Definition
abort-mode.h:41
v8
Definition
api-arguments-inl.h:19
V8_INLINE
#define V8_INLINE
Definition
v8config.h:500
src
base
abort-mode.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0