mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:07:46 +00:00
Kernel: Add initial basic support for KASAN
This commit adds minimal support for compiler-instrumentation based memory access sanitization. Currently we only support detection of kmalloc redzone accesses, and kmalloc use-after-free accesses. Support for inline checks (for improved performance), and for stack use-after-return and use-after-return detection is left for future PRs.
This commit is contained in:
parent
7ad7ae7000
commit
f7a1f28d7f
10 changed files with 538 additions and 63 deletions
|
@ -145,7 +145,7 @@ new file mode 100644
|
|||
index 000000000..4fdf45a19
|
||||
--- /dev/null
|
||||
+++ b/clang/lib/Driver/ToolChains/Serenity.cpp
|
||||
@@ -0,0 +1,336 @@
|
||||
@@ -0,0 +1,340 @@
|
||||
+//===---- Serenity.cpp - SerenityOS ToolChain Implementation ----*- C++ -*-===//
|
||||
+//
|
||||
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
|
@ -482,12 +482,16 @@ index 000000000..4fdf45a19
|
|||
+
|
||||
+ return ToolChain::UNW_None;
|
||||
+}
|
||||
+
|
||||
+SanitizerMask Serenity::getSupportedSanitizers() const {
|
||||
+ return ToolChain::getSupportedSanitizers() | SanitizerKind::KernelAddress;
|
||||
+}
|
||||
diff --git a/clang/lib/Driver/ToolChains/Serenity.h b/clang/lib/Driver/ToolChains/Serenity.h
|
||||
new file mode 100644
|
||||
index 000000000..feb31a0d6
|
||||
--- /dev/null
|
||||
+++ b/clang/lib/Driver/ToolChains/Serenity.h
|
||||
@@ -0,0 +1,100 @@
|
||||
@@ -0,0 +1,102 @@
|
||||
+//===---- Serenity.h - SerenityOS ToolChain Implementation ------*- C++ -*-===//
|
||||
+//
|
||||
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
|
@ -563,6 +567,8 @@ index 000000000..feb31a0d6
|
|||
+ bool isPIEDefault(const llvm::opt::ArgList&) const override { return false; }
|
||||
+ bool isPICDefaultForced() const override { return false; }
|
||||
+
|
||||
+ SanitizerMask getSupportedSanitizers() const override;
|
||||
+
|
||||
+ bool IsMathErrnoDefault() const override { return false; }
|
||||
+
|
||||
+ UnwindTableLevel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue