mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
Kernel: Expose sysctl 'ubsan_is_deadly' to panic the Kernel on UB
This makes it easier to find UB, for example when fuzzing the Kernel.
This can be enabled by default, thanks to @boricj's work in
32e1354b9b
.
This commit is contained in:
parent
a0362d827c
commit
00131d244e
Notes:
sideshowbarker
2024-07-18 21:38:47 +09:00
Author: https://github.com/BenWiederhake
Commit: 00131d244e
Pull-request: https://github.com/SerenityOS/serenity/pull/5677
3 changed files with 14 additions and 1 deletions
|
@ -26,22 +26,26 @@
|
|||
|
||||
#include <AK/Format.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/Panic.h>
|
||||
#include <Kernel/UBSanitizer.h>
|
||||
|
||||
using namespace Kernel;
|
||||
using namespace Kernel::UBSanitizer;
|
||||
|
||||
bool Kernel::UBSanitizer::g_ubsan_is_deadly { true };
|
||||
|
||||
extern "C" {
|
||||
|
||||
static void print_location(const SourceLocation& location)
|
||||
{
|
||||
if (!location.filename()) {
|
||||
dbgln("KUBSAN: in unknown file");
|
||||
|
||||
} else {
|
||||
dbgln("KUBSAN: at {}, line {}, column: {}", location.filename(), location.line(), location.column());
|
||||
}
|
||||
dump_backtrace();
|
||||
if (g_ubsan_is_deadly)
|
||||
PANIC("UB is configured to be deadly.");
|
||||
}
|
||||
|
||||
void __ubsan_handle_load_invalid_value(const InvalidValueData&, ValueHandle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue