Handles kernel address sanitizer runtime errors.
More...
#include <kasan.h>
|
| static void | handle (bool write, uintptr_t address, size_t size, void *rip) |
| | Handles a KASan error by panicking and printing the details.
|
| |
| static void | initialize () |
| | Initializes the KASan handler by setting up the shadow memory.
|
| |
| static void | poison_stack (uintptr_t address, size_t size) |
| | Marks a region of stack memory as poisoned (inaccessible)
|
| |
| static void | unpoison_stack (uintptr_t address, size_t size) |
| | Marks a region of stack memory as unpoisoned (accessible)
|
| |
Handles kernel address sanitizer runtime errors.
- Todo:
- finish when cbf
Definition at line 23 of file kasan.h.
◆ handle()
| void KASanHandler::handle |
( |
bool |
write, |
|
|
uintptr_t |
address, |
|
|
size_t |
size, |
|
|
void * |
rip |
|
) |
| |
|
static |
Handles a KASan error by panicking and printing the details.
- Parameters
-
| write | Whether the access was a write (true) or read (false) |
| address | The address that was accessed |
| size | The size of the access in bytes |
| rip | The instruction pointer where the access occurred |
Definition at line 27 of file kasan.cpp.
27 {
28 ASSERT(
false,
"KASAN ERROR: %s of size %zu at address 0x%lx from RIP 0x%p", write ?
"WRITE" :
"READ", size, address, rip);
29}
#define ASSERT(condition, format,...)
If the specified condition is not met then the kernel will crash with the specified message.
References ASSERT.
Referenced by __asan_load16_noabort(), __asan_load1_noabort(), __asan_load2_noabort(), __asan_load4_noabort(), __asan_load8_noabort(), __asan_loadN_noabort(), __asan_store16_noabort(), __asan_store1_noabort(), __asan_store2_noabort(), __asan_store4_noabort(), __asan_store8_noabort(), and __asan_storeN_noabort().
◆ initialize()
| void KASanHandler::initialize |
( |
| ) |
|
|
static |
Initializes the KASan handler by setting up the shadow memory.
Definition at line 34 of file kasan.cpp.
◆ poison_stack()
| void KASanHandler::poison_stack |
( |
uintptr_t |
address, |
|
|
size_t |
size |
|
) |
| |
|
static |
Marks a region of stack memory as poisoned (inaccessible)
- Parameters
-
| address | The starting address of the region |
| size | The size of the region in bytes |
Definition at line 44 of file kasan.cpp.
◆ unpoison_stack()
| void KASanHandler::unpoison_stack |
( |
uintptr_t |
address, |
|
|
size_t |
size |
|
) |
| |
|
static |
Marks a region of stack memory as unpoisoned (accessible)
- Parameters
-
| address | The starting address of the region |
| size | The size of the region in bytes |
Definition at line 54 of file kasan.cpp.
The documentation for this class was generated from the following files:
- /home/runner/work/MaxOS/MaxOS/kernel/include/runtime/kasan.h
- /home/runner/work/MaxOS/MaxOS/kernel/src/runtime/kasan.cpp