fuzzing: When fuzzing, always ASSERT, and abort() instead of SIGTRAP
Currently, when we hit an assertion failure, the fuzzer stops immediately without producing a crash. This patch makes it so that we do a hard abort instead which will be caught. Bug: dawn:295, dawn:293 Fixes: dawn:293 Change-Id: Ie00074e84b51c9aa364aba96c11a35659bbba740 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14682 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
cf788596f4
commit
5217ad51c5
|
@ -15,11 +15,17 @@
|
||||||
#include "common/Assert.h"
|
#include "common/Assert.h"
|
||||||
#include "common/Log.h"
|
#include "common/Log.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
void HandleAssertionFailure(const char* file,
|
void HandleAssertionFailure(const char* file,
|
||||||
const char* function,
|
const char* function,
|
||||||
int line,
|
int line,
|
||||||
const char* condition) {
|
const char* condition) {
|
||||||
dawn::ErrorLog() << "Assertion failure at " << file << ":" << line << " (" << function
|
dawn::ErrorLog() << "Assertion failure at " << file << ":" << line << " (" << function
|
||||||
<< "): " << condition;
|
<< "): " << condition;
|
||||||
|
#if defined(DAWN_ABORT_ON_ASSERT)
|
||||||
|
abort();
|
||||||
|
#else
|
||||||
DAWN_BREAKPOINT();
|
DAWN_BREAKPOINT();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,12 @@ if (build_with_chromium) {
|
||||||
dcheck_always_on = false
|
dcheck_always_on = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (build_with_chromium) {
|
||||||
|
import("//build/config/sanitizers/sanitizers.gni")
|
||||||
|
} else {
|
||||||
|
use_fuzzing_engine = false
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Common dawn configs
|
# Common dawn configs
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -43,10 +49,16 @@ config("dawn_internal") {
|
||||||
]
|
]
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
if (dawn_always_assert || dcheck_always_on || is_debug) {
|
if (dawn_always_assert || dcheck_always_on || is_debug ||
|
||||||
|
use_fuzzing_engine) {
|
||||||
defines += [ "DAWN_ENABLE_ASSERTS" ]
|
defines += [ "DAWN_ENABLE_ASSERTS" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (use_fuzzing_engine) {
|
||||||
|
# Does a hard abort when an assertion fails so that fuzzers catch and parse the failure.
|
||||||
|
defines += [ "DAWN_ABORT_ON_ASSERT" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (dawn_enable_d3d12) {
|
if (dawn_enable_d3d12) {
|
||||||
defines += [ "DAWN_ENABLE_BACKEND_D3D12" ]
|
defines += [ "DAWN_ENABLE_BACKEND_D3D12" ]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue