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
Notes:
sideshowbarker
2024-07-17 22:46:02 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/3e9fb9f23cd Pull-request: https://github.com/SerenityOS/serenity/pull/11031 Reviewed-by: https://github.com/BenWiederhake Reviewed-by: https://github.com/bgianfo Reviewed-by: https://github.com/mjz19910
1 changed files with 6 additions and 3 deletions
|
@ -9,7 +9,6 @@
|
|||
|
||||
using namespace AK::UBSanitizer;
|
||||
|
||||
// FIXME: Parse option from UBSAN_OPTIONS: halt_on_error=0 or 1
|
||||
bool AK::UBSanitizer::g_ubsan_is_deadly { false };
|
||||
|
||||
#define WARNLN_AND_DBGLN(fmt, ...) \
|
||||
|
@ -34,8 +33,12 @@ static void print_location(const SourceLocation& location)
|
|||
checked_env_for_deadly = true;
|
||||
StringView options = getenv("UBSAN_OPTIONS");
|
||||
// FIXME: Parse more options and complain about invalid options
|
||||
if (!options.is_null() && options.contains("halt_on_error=1"))
|
||||
g_ubsan_is_deadly = true;
|
||||
if (!options.is_null()) {
|
||||
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) {
|
||||
WARNLN_AND_DBGLN("UB is configured to be deadly");
|
||||
|
|
Loading…
Add table
Reference in a new issue