mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibSanitizer: Check for halt_on_error=0 in $UBSAN_OPTIONS
This allows a developer to set the g_ubsan_is_deadly flag to true by default and still disable UBSAN for certain applications.
This commit is contained in:
parent
815f15f82c
commit
3e9fb9f23c
1 changed files with 6 additions and 3 deletions
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
using namespace AK::UBSanitizer;
|
using namespace AK::UBSanitizer;
|
||||||
|
|
||||||
// FIXME: Parse option from UBSAN_OPTIONS: halt_on_error=0 or 1
|
|
||||||
bool AK::UBSanitizer::g_ubsan_is_deadly { false };
|
bool AK::UBSanitizer::g_ubsan_is_deadly { false };
|
||||||
|
|
||||||
#define WARNLN_AND_DBGLN(fmt, ...) \
|
#define WARNLN_AND_DBGLN(fmt, ...) \
|
||||||
|
@ -34,8 +33,12 @@ static void print_location(const SourceLocation& location)
|
||||||
checked_env_for_deadly = true;
|
checked_env_for_deadly = true;
|
||||||
StringView options = getenv("UBSAN_OPTIONS");
|
StringView options = getenv("UBSAN_OPTIONS");
|
||||||
// FIXME: Parse more options and complain about invalid options
|
// FIXME: Parse more options and complain about invalid options
|
||||||
if (!options.is_null() && options.contains("halt_on_error=1"))
|
if (!options.is_null()) {
|
||||||
g_ubsan_is_deadly = true;
|
if (options.contains("halt_on_error=1"))
|
||||||
|
g_ubsan_is_deadly = true;
|
||||||
|
else if (options.contains("halt_on_error=0"))
|
||||||
|
g_ubsan_is_deadly = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (g_ubsan_is_deadly) {
|
if (g_ubsan_is_deadly) {
|
||||||
WARNLN_AND_DBGLN("UB is configured to be deadly");
|
WARNLN_AND_DBGLN("UB is configured to be deadly");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue