Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::runtime::KASanHandler Class Reference

Handles kernel address sanitizer runtime errors. More...

#include <kasan.h>

Static Public Member Functions

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)
 

Detailed Description

Handles kernel address sanitizer runtime errors.

Todo:
finish when cbf

Definition at line 23 of file kasan.h.

Member Function Documentation

◆ 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
writeWhether the access was a write (true) or read (false)
addressThe address that was accessed
sizeThe size of the access in bytes
ripThe 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.
Definition logger.h:100

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.

34 {
35
36}

◆ poison_stack()

void KASanHandler::poison_stack ( uintptr_t  address,
size_t  size 
)
static

Marks a region of stack memory as poisoned (inaccessible)

Parameters
addressThe starting address of the region
sizeThe size of the region in bytes

Definition at line 44 of file kasan.cpp.

44 {
45
46}

◆ unpoison_stack()

void KASanHandler::unpoison_stack ( uintptr_t  address,
size_t  size 
)
static

Marks a region of stack memory as unpoisoned (accessible)

Parameters
addressThe starting address of the region
sizeThe size of the region in bytes

Definition at line 54 of file kasan.cpp.

54 {
55
56}

The documentation for this class was generated from the following files: