FreeBSD kernel kern code
subr_asan.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/asan.h>
#include <sys/kernel.h>
#include <sys/stack.h>
#include <sys/sysctl.h>
#include <machine/asan.h>
#include <machine/atomic.h>
#include <sys/atomic_san.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/bus_san.h>
Include dependency graph for subr_asan.c:

Go to the source code of this file.

Data Structures

struct  __asan_global_source_location
 
struct  __asan_global
 

Macros

#define SAN_RUNTIME
 
#define KASAN_SHADOW_MASK   (KASAN_SHADOW_SCALE - 1)
 
#define KASAN_ALLOCA_SCALE_SIZE   32
 
#define __RET_ADDR   (unsigned long)__builtin_return_address(0)
 
#define REPORT(f, ...)
 
#define ADDR_CROSSES_SCALE_BOUNDARY(addr, size)
 
#define _ASAN_ATOMIC_FUNC_ADD(name, type)
 
#define ASAN_ATOMIC_FUNC_ADD(name, type)
 
#define _ASAN_ATOMIC_FUNC_SUBTRACT(name, type)
 
#define ASAN_ATOMIC_FUNC_SUBTRACT(name, type)
 
#define _ASAN_ATOMIC_FUNC_SET(name, type)
 
#define ASAN_ATOMIC_FUNC_SET(name, type)
 
#define _ASAN_ATOMIC_FUNC_CLEAR(name, type)
 
#define ASAN_ATOMIC_FUNC_CLEAR(name, type)
 
#define ASAN_ATOMIC_FUNC_FETCHADD(name, type)
 
#define ASAN_ATOMIC_FUNC_READANDCLEAR(name, type)
 
#define ASAN_ATOMIC_FUNC_TESTANDCLEAR(name, type)
 
#define ASAN_ATOMIC_FUNC_TESTANDSET(name, type)
 
#define ASAN_ATOMIC_FUNC_SWAP(name, type)
 
#define _ASAN_ATOMIC_FUNC_CMPSET(name, type)
 
#define ASAN_ATOMIC_FUNC_CMPSET(name, type)
 
#define _ASAN_ATOMIC_FUNC_FCMPSET(name, type)
 
#define ASAN_ATOMIC_FUNC_FCMPSET(name, type)
 
#define ASAN_ATOMIC_FUNC_THREAD_FENCE(name)
 
#define _ASAN_ATOMIC_FUNC_LOAD(name, type)
 
#define ASAN_ATOMIC_FUNC_LOAD(name, type)
 
#define _ASAN_ATOMIC_FUNC_STORE(name, type)
 
#define ASAN_ATOMIC_FUNC_STORE(name, type)
 
#define ASAN_BUS_READ_FUNC(func, width, type)
 
#define ASAN_BUS_READ_PTR_FUNC(func, width, type)
 
#define ASAN_BUS_WRITE_FUNC(func, width, type)
 
#define ASAN_BUS_WRITE_PTR_FUNC(func, width, type)
 
#define ASAN_BUS_SET_FUNC(func, width, type)
 
#define ASAN_LOAD_STORE(size)
 
#define ASAN_SET_SHADOW(byte)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 FEATURE (kasan, "Kernel address sanitizer")
 
static SYSCTL_NODE (_debug, OID_AUTO, kasan, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "KASAN options")
 
 SYSCTL_INT (_debug_kasan, OID_AUTO, panic_on_violation, CTLFLAG_RDTUN, &panic_on_violation, 0, "Panic if an invalid access is detected")
 
void kasan_shadow_map (vm_offset_t addr, size_t size)
 
void kasan_init (void)
 
static const char * kasan_code_name (uint8_t code)
 
static void kasan_report (unsigned long addr, size_t size, bool write, unsigned long pc, uint8_t code)
 
static __always_inline void kasan_shadow_1byte_markvalid (unsigned long addr)
 
static __always_inline void kasan_shadow_Nbyte_markvalid (const void *addr, size_t size)
 
static __always_inline void kasan_shadow_Nbyte_fill (const void *addr, size_t size, uint8_t code)
 
void kasan_mark (const void *addr, size_t size, size_t redzsize, uint8_t code)
 
static __always_inline bool kasan_shadow_1byte_isvalid (unsigned long addr, uint8_t *code)
 
static __always_inline bool kasan_shadow_2byte_isvalid (unsigned long addr, uint8_t *code)
 
static __always_inline bool kasan_shadow_4byte_isvalid (unsigned long addr, uint8_t *code)
 
static __always_inline bool kasan_shadow_8byte_isvalid (unsigned long addr, uint8_t *code)
 
static __always_inline bool kasan_shadow_Nbyte_isvalid (unsigned long addr, size_t size, uint8_t *code)
 
static __always_inline void kasan_shadow_check (unsigned long addr, size_t size, bool write, unsigned long retaddr)
 
void * kasan_memcpy (void *dst, const void *src, size_t len)
 
int kasan_memcmp (const void *b1, const void *b2, size_t len)
 
void * kasan_memset (void *b, int c, size_t len)
 
void * kasan_memmove (void *dst, const void *src, size_t len)
 
size_t kasan_strlen (const char *str)
 
char * kasan_strcpy (char *dst, const char *src)
 
int kasan_strcmp (const char *s1, const char *s2)
 
int kasan_copyin (const void *uaddr, void *kaddr, size_t len)
 
int kasan_copyinstr (const void *uaddr, void *kaddr, size_t len, size_t *done)
 
int kasan_copyout (const void *kaddr, void *uaddr, size_t len)
 
int kasan_fubyte (volatile const void *base)
 
int kasan_fuword16 (volatile const void *base)
 
int kasan_fueword (volatile const void *base, long *val)
 
int kasan_fueword32 (volatile const void *base, int32_t *val)
 
int kasan_fueword64 (volatile const void *base, int64_t *val)
 
int kasan_subyte (volatile void *base, int byte)
 
int kasan_suword (volatile void *base, long word)
 
int kasan_suword16 (volatile void *base, int word)
 
int kasan_suword32 (volatile void *base, int32_t word)
 
int kasan_suword64 (volatile void *base, int64_t word)
 
int kasan_casueword32 (volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, uint32_t newval)
 
int kasan_casueword (volatile u_long *base, u_long oldval, u_long *oldvalp, u_long newval)
 
 ASAN_ATOMIC_FUNC_ADD (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_ADD (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_ADD (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_ADD (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_ADD (int, u_int)
 
 ASAN_ATOMIC_FUNC_ADD (long, u_long)
 
 ASAN_ATOMIC_FUNC_ADD (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (int, u_int)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (long, u_long)
 
 ASAN_ATOMIC_FUNC_SUBTRACT (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_SET (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_SET (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_SET (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_SET (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_SET (int, u_int)
 
 ASAN_ATOMIC_FUNC_SET (long, u_long)
 
 ASAN_ATOMIC_FUNC_SET (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_CLEAR (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_CLEAR (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_CLEAR (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_CLEAR (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_CLEAR (int, u_int)
 
 ASAN_ATOMIC_FUNC_CLEAR (long, u_long)
 
 ASAN_ATOMIC_FUNC_CLEAR (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_FETCHADD (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_FETCHADD (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_FETCHADD (int, u_int)
 
 ASAN_ATOMIC_FUNC_FETCHADD (long, u_long)
 
 ASAN_ATOMIC_FUNC_READANDCLEAR (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_READANDCLEAR (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_READANDCLEAR (int, u_int)
 
 ASAN_ATOMIC_FUNC_READANDCLEAR (long, u_long)
 
 ASAN_ATOMIC_FUNC_READANDCLEAR (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_TESTANDCLEAR (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_TESTANDCLEAR (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_TESTANDCLEAR (int, u_int)
 
 ASAN_ATOMIC_FUNC_TESTANDCLEAR (long, u_long)
 
 ASAN_ATOMIC_FUNC_TESTANDSET (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_TESTANDSET (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_TESTANDSET (int, u_int)
 
 ASAN_ATOMIC_FUNC_TESTANDSET (long, u_long)
 
 ASAN_ATOMIC_FUNC_SWAP (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_SWAP (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_SWAP (int, u_int)
 
 ASAN_ATOMIC_FUNC_SWAP (long, u_long)
 
 ASAN_ATOMIC_FUNC_SWAP (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_CMPSET (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_CMPSET (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_CMPSET (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_CMPSET (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_CMPSET (int, u_int)
 
 ASAN_ATOMIC_FUNC_CMPSET (long, u_long)
 
 ASAN_ATOMIC_FUNC_CMPSET (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_FCMPSET (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_FCMPSET (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_FCMPSET (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_FCMPSET (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_FCMPSET (int, u_int)
 
 ASAN_ATOMIC_FUNC_FCMPSET (long, u_long)
 
 ASAN_ATOMIC_FUNC_FCMPSET (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_LOAD (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_LOAD (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_LOAD (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_LOAD (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_LOAD (char, u_char)
 
 ASAN_ATOMIC_FUNC_LOAD (short, u_short)
 
 ASAN_ATOMIC_FUNC_LOAD (int, u_int)
 
 ASAN_ATOMIC_FUNC_LOAD (long, u_long)
 
 ASAN_ATOMIC_FUNC_LOAD (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_STORE (8, uint8_t)
 
 ASAN_ATOMIC_FUNC_STORE (16, uint16_t)
 
 ASAN_ATOMIC_FUNC_STORE (32, uint32_t)
 
 ASAN_ATOMIC_FUNC_STORE (64, uint64_t)
 
 ASAN_ATOMIC_FUNC_STORE (char, u_char)
 
 ASAN_ATOMIC_FUNC_STORE (short, u_short)
 
 ASAN_ATOMIC_FUNC_STORE (int, u_int)
 
 ASAN_ATOMIC_FUNC_STORE (long, u_long)
 
 ASAN_ATOMIC_FUNC_STORE (ptr, uintptr_t)
 
 ASAN_ATOMIC_FUNC_THREAD_FENCE (acq)
 
 ASAN_ATOMIC_FUNC_THREAD_FENCE (rel)
 
 ASAN_ATOMIC_FUNC_THREAD_FENCE (acq_rel)
 
 ASAN_ATOMIC_FUNC_THREAD_FENCE (seq_cst)
 
void kasan_atomic_interrupt_fence (void)
 
int kasan_bus_space_map (bus_space_tag_t tag, bus_addr_t hnd, bus_size_t size, int flags, bus_space_handle_t *handlep)
 
void kasan_bus_space_unmap (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t size)
 
int kasan_bus_space_subregion (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t offset, bus_size_t size, bus_space_handle_t *handlep)
 
void kasan_bus_space_free (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t size)
 
void kasan_bus_space_barrier (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t offset, bus_size_t size, int flags)
 
void __asan_register_globals (struct __asan_global *, size_t)
 
void __asan_unregister_globals (struct __asan_global *, size_t)
 
 ASAN_LOAD_STORE (1)
 
 ASAN_LOAD_STORE (2)
 
 ASAN_LOAD_STORE (4)
 
 ASAN_LOAD_STORE (8)
 
 ASAN_LOAD_STORE (16)
 
void __asan_loadN (unsigned long, size_t)
 
void __asan_loadN_noabort (unsigned long, size_t)
 
void __asan_storeN (unsigned long, size_t)
 
void __asan_storeN_noabort (unsigned long, size_t)
 
void __asan_handle_no_return (void)
 
 ASAN_SET_SHADOW (00)
 
 ASAN_SET_SHADOW (f1)
 
 ASAN_SET_SHADOW (f2)
 
 ASAN_SET_SHADOW (f3)
 
 ASAN_SET_SHADOW (f5)
 
 ASAN_SET_SHADOW (f8)
 
void __asan_poison_stack_memory (const void *, size_t)
 
void __asan_unpoison_stack_memory (const void *, size_t)
 
void __asan_alloca_poison (const void *, size_t)
 
void __asan_allocas_unpoison (const void *, const void *)
 
void __asan_poison_memory_region (const void *addr, size_t size)
 
void __asan_unpoison_memory_region (const void *addr, size_t size)
 

Variables

static int panic_on_violation = 1
 
static bool kasan_enabled __read_mostly = false
 

Macro Definition Documentation

◆ __RET_ADDR

#define __RET_ADDR   (unsigned long)__builtin_return_address(0)

Definition at line 63 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_ADD

#define _ASAN_ATOMIC_FUNC_ADD (   name,
  type 
)
Value:
void kasan_atomic_add_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
atomic_add_##name(ptr, val); \
}
device_property_type_t type
Definition: bus_if.m:941
const char * name
Definition: kern_fail.c:145
#define __RET_ADDR
Definition: subr_asan.c:63

Definition at line 611 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_CLEAR

#define _ASAN_ATOMIC_FUNC_CLEAR (   name,
  type 
)
Value:
void kasan_atomic_clear_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
atomic_clear_##name(ptr, val); \
}

Definition at line 650 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_CMPSET

#define _ASAN_ATOMIC_FUNC_CMPSET (   name,
  type 
)
Value:
int kasan_atomic_cmpset_##name(volatile type *ptr, type oval, \
type nval) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_cmpset_##name(ptr, oval, nval)); \
}

Definition at line 703 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_FCMPSET

#define _ASAN_ATOMIC_FUNC_FCMPSET (   name,
  type 
)
Value:
int kasan_atomic_fcmpset_##name(volatile type *ptr, type *oval, \
type nval) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_fcmpset_##name(ptr, oval, nval)); \
}

Definition at line 717 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_LOAD

#define _ASAN_ATOMIC_FUNC_LOAD (   name,
  type 
)
Value:
type kasan_atomic_load_##name(volatile type *ptr) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_load_##name(ptr)); \
}

Definition at line 737 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_SET

#define _ASAN_ATOMIC_FUNC_SET (   name,
  type 
)
Value:
void kasan_atomic_set_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
atomic_set_##name(ptr, val); \
}

Definition at line 637 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_STORE

#define _ASAN_ATOMIC_FUNC_STORE (   name,
  type 
)
Value:
void kasan_atomic_store_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
atomic_store_##name(ptr, val); \
}

Definition at line 749 of file subr_asan.c.

◆ _ASAN_ATOMIC_FUNC_SUBTRACT

#define _ASAN_ATOMIC_FUNC_SUBTRACT (   name,
  type 
)
Value:
void kasan_atomic_subtract_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
atomic_subtract_##name(ptr, val); \
}

Definition at line 624 of file subr_asan.c.

◆ ADDR_CROSSES_SCALE_BOUNDARY

#define ADDR_CROSSES_SCALE_BOUNDARY (   addr,
  size 
)
Value:
(addr >> KASAN_SHADOW_SCALE_SHIFT) != \
((addr + size - 1) >> KASAN_SHADOW_SCALE_SHIFT)
uint64_t * addr
Definition: msi_if.m:89

Definition at line 287 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_ADD

#define ASAN_ATOMIC_FUNC_ADD (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_ADD(acq_##name, type) \
_ASAN_ATOMIC_FUNC_ADD(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_ADD(name, type)
Definition: subr_asan.c:611

Definition at line 619 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_CLEAR

#define ASAN_ATOMIC_FUNC_CLEAR (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_CLEAR(acq_##name, type) \
_ASAN_ATOMIC_FUNC_CLEAR(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_CLEAR(name, type)
Definition: subr_asan.c:650

Definition at line 658 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_CMPSET

#define ASAN_ATOMIC_FUNC_CMPSET (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_CMPSET(acq_##name, type) \
_ASAN_ATOMIC_FUNC_CMPSET(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_CMPSET(name, type)
Definition: subr_asan.c:703

Definition at line 712 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_FCMPSET

#define ASAN_ATOMIC_FUNC_FCMPSET (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_FCMPSET(acq_##name, type) \
_ASAN_ATOMIC_FUNC_FCMPSET(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_FCMPSET(name, type)
Definition: subr_asan.c:717

Definition at line 726 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_FETCHADD

#define ASAN_ATOMIC_FUNC_FETCHADD (   name,
  type 
)
Value:
type kasan_atomic_fetchadd_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_fetchadd_##name(ptr, val)); \
}

Definition at line 663 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_LOAD

#define ASAN_ATOMIC_FUNC_LOAD (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_LOAD(acq_##name, type)
#define _ASAN_ATOMIC_FUNC_LOAD(name, type)
Definition: subr_asan.c:737

Definition at line 745 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_READANDCLEAR

#define ASAN_ATOMIC_FUNC_READANDCLEAR (   name,
  type 
)
Value:
type kasan_atomic_readandclear_##name(volatile type *ptr) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_readandclear_##name(ptr)); \
}

Definition at line 671 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_SET

#define ASAN_ATOMIC_FUNC_SET (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_SET(acq_##name, type) \
_ASAN_ATOMIC_FUNC_SET(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_SET(name, type)
Definition: subr_asan.c:637

Definition at line 645 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_STORE

#define ASAN_ATOMIC_FUNC_STORE (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_STORE(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_STORE(name, type)
Definition: subr_asan.c:749

Definition at line 757 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_SUBTRACT

#define ASAN_ATOMIC_FUNC_SUBTRACT (   name,
  type 
)
Value:
_ASAN_ATOMIC_FUNC_SUBTRACT(acq_##name, type) \
_ASAN_ATOMIC_FUNC_SUBTRACT(rel_##name, type)
#define _ASAN_ATOMIC_FUNC_SUBTRACT(name, type)
Definition: subr_asan.c:624

Definition at line 632 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_SWAP

#define ASAN_ATOMIC_FUNC_SWAP (   name,
  type 
)
Value:
type kasan_atomic_swap_##name(volatile type *ptr, type val) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_swap_##name(ptr, val)); \
}

Definition at line 695 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_TESTANDCLEAR

#define ASAN_ATOMIC_FUNC_TESTANDCLEAR (   name,
  type 
)
Value:
int kasan_atomic_testandclear_##name(volatile type *ptr, u_int v) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_testandclear_##name(ptr, v)); \
}

Definition at line 679 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_TESTANDSET

#define ASAN_ATOMIC_FUNC_TESTANDSET (   name,
  type 
)
Value:
int kasan_atomic_testandset_##name(volatile type *ptr, u_int v) \
{ \
kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \
return (atomic_testandset_##name(ptr, v)); \
}

Definition at line 687 of file subr_asan.c.

◆ ASAN_ATOMIC_FUNC_THREAD_FENCE

#define ASAN_ATOMIC_FUNC_THREAD_FENCE (   name)
Value:
void kasan_atomic_thread_fence_##name(void) \
{ \
atomic_thread_fence_##name(); \
}

Definition at line 731 of file subr_asan.c.

◆ ASAN_BUS_READ_FUNC

#define ASAN_BUS_READ_FUNC (   func,
  width,
  type 
)
Value:
type kasan_bus_space_read##func##_##width(bus_space_tag_t tag, \
bus_space_handle_t hnd, bus_size_t offset) \
{ \
return (bus_space_read##func##_##width(tag, hnd, \
offset)); \
} \

Definition at line 907 of file subr_asan.c.

◆ ASAN_BUS_READ_PTR_FUNC

#define ASAN_BUS_READ_PTR_FUNC (   func,
  width,
  type 
)
Value:
void kasan_bus_space_read_##func##_##width(bus_space_tag_t tag, \
bus_space_handle_t hnd, bus_size_t size, type *buf, \
bus_size_t count) \
{ \
kasan_shadow_check((uintptr_t)buf, sizeof(type) * count,\
false, __RET_ADDR); \
bus_space_read_##func##_##width(tag, hnd, size, buf, \
count); \
}
int * count
Definition: cpufreq_if.m:63
struct stat * buf

Definition at line 915 of file subr_asan.c.

◆ ASAN_BUS_SET_FUNC

#define ASAN_BUS_SET_FUNC (   func,
  width,
  type 
)
Value:
void kasan_bus_space_set_##func##_##width(bus_space_tag_t tag, \
bus_space_handle_t hnd, bus_size_t offset, type value, \
bus_size_t count) \
{ \
bus_space_set_##func##_##width(tag, hnd, offset, value, \
count); \
}
caddr_t value
Definition: linker_if.m:63

Definition at line 990 of file subr_asan.c.

◆ ASAN_BUS_WRITE_FUNC

#define ASAN_BUS_WRITE_FUNC (   func,
  width,
  type 
)
Value:
void kasan_bus_space_write##func##_##width(bus_space_tag_t tag, \
bus_space_handle_t hnd, bus_size_t offset, type value) \
{ \
bus_space_write##func##_##width(tag, hnd, offset, value);\
} \

Definition at line 949 of file subr_asan.c.

◆ ASAN_BUS_WRITE_PTR_FUNC

#define ASAN_BUS_WRITE_PTR_FUNC (   func,
  width,
  type 
)
Value:
void kasan_bus_space_write_##func##_##width(bus_space_tag_t tag,\
bus_space_handle_t hnd, bus_size_t size, const type *buf, \
bus_size_t count) \
{ \
kasan_shadow_check((uintptr_t)buf, sizeof(type) * count,\
true, __RET_ADDR); \
bus_space_write_##func##_##width(tag, hnd, size, buf, \
count); \
}

Definition at line 956 of file subr_asan.c.

◆ ASAN_LOAD_STORE

#define ASAN_LOAD_STORE (   size)
Value:
void __asan_load##size(unsigned long); \
void __asan_load##size(unsigned long addr) \
{ \
kasan_shadow_check(addr, size, false, __RET_ADDR);\
} \
void __asan_load##size##_noabort(unsigned long); \
void __asan_load##size##_noabort(unsigned long addr) \
{ \
kasan_shadow_check(addr, size, false, __RET_ADDR);\
} \
void __asan_store##size(unsigned long); \
void __asan_store##size(unsigned long addr) \
{ \
kasan_shadow_check(addr, size, true, __RET_ADDR);\
} \
void __asan_store##size##_noabort(unsigned long); \
void __asan_store##size##_noabort(unsigned long addr) \
{ \
kasan_shadow_check(addr, size, true, __RET_ADDR);\
}

Definition at line 1041 of file subr_asan.c.

◆ ASAN_SET_SHADOW

#define ASAN_SET_SHADOW (   byte)
Value:
void __asan_set_shadow_##byte(void *, size_t); \
void __asan_set_shadow_##byte(void *addr, size_t size) \
{ \
__builtin_memset((void *)addr, 0x##byte, size); \
}

Definition at line 1105 of file subr_asan.c.

◆ KASAN_ALLOCA_SCALE_SIZE

#define KASAN_ALLOCA_SCALE_SIZE   32

Definition at line 50 of file subr_asan.c.

◆ KASAN_SHADOW_MASK

#define KASAN_SHADOW_MASK   (KASAN_SHADOW_SCALE - 1)

Definition at line 49 of file subr_asan.c.

◆ REPORT

#define REPORT (   f,
  ... 
)
Value:
do { \
kasan_enabled = false; \
panic(f, __VA_ARGS__); \
} else { \
struct stack st; \
\
stack_save(&st); \
printf(f "\n", __VA_ARGS__); \
stack_print_ddb(&st); \
} \
} while (0)
static struct bt_table st
static int panic_on_violation
Definition: subr_asan.c:90

Definition at line 175 of file subr_asan.c.

◆ SAN_RUNTIME

#define SAN_RUNTIME

Definition at line 31 of file subr_asan.c.

Function Documentation

◆ __asan_alloca_poison()

void __asan_alloca_poison ( const void *  addr,
size_t  size 
)

Definition at line 1139 of file subr_asan.c.

References addr, KASAN_ALLOCA_SCALE_SIZE, kasan_mark(), and kasan_shadow_Nbyte_fill().

Here is the call graph for this function:

◆ __asan_allocas_unpoison()

void __asan_allocas_unpoison ( const void *  stkbegin,
const void *  stkend 
)

Definition at line 1156 of file subr_asan.c.

References kasan_shadow_Nbyte_fill().

Here is the call graph for this function:

◆ __asan_handle_no_return()

void __asan_handle_no_return ( void  )

Definition at line 1100 of file subr_asan.c.

◆ __asan_loadN()

void __asan_loadN ( unsigned long  addr,
size_t  size 
)

Definition at line 1076 of file subr_asan.c.

References __RET_ADDR, addr, and kasan_shadow_check().

Here is the call graph for this function:

◆ __asan_loadN_noabort()

void __asan_loadN_noabort ( unsigned long  addr,
size_t  size 
)

Definition at line 1082 of file subr_asan.c.

References __RET_ADDR, addr, and kasan_shadow_check().

Here is the call graph for this function:

◆ __asan_poison_memory_region()

void __asan_poison_memory_region ( const void *  addr,
size_t  size 
)

Definition at line 1173 of file subr_asan.c.

◆ __asan_poison_stack_memory()

void __asan_poison_stack_memory ( const void *  addr,
size_t  size 
)

Definition at line 1123 of file subr_asan.c.

References addr, and kasan_shadow_Nbyte_fill().

Here is the call graph for this function:

◆ __asan_register_globals()

void __asan_register_globals ( struct __asan_global globals,
size_t  n 
)

Definition at line 1020 of file subr_asan.c.

References kasan_mark().

Here is the call graph for this function:

◆ __asan_storeN()

void __asan_storeN ( unsigned long  addr,
size_t  size 
)

Definition at line 1088 of file subr_asan.c.

References __RET_ADDR, addr, and kasan_shadow_check().

Here is the call graph for this function:

◆ __asan_storeN_noabort()

void __asan_storeN_noabort ( unsigned long  addr,
size_t  size 
)

Definition at line 1094 of file subr_asan.c.

References __RET_ADDR, addr, and kasan_shadow_check().

Here is the call graph for this function:

◆ __asan_unpoison_memory_region()

void __asan_unpoison_memory_region ( const void *  addr,
size_t  size 
)

Definition at line 1178 of file subr_asan.c.

◆ __asan_unpoison_stack_memory()

void __asan_unpoison_stack_memory ( const void *  addr,
size_t  size 
)

Definition at line 1130 of file subr_asan.c.

References addr, and kasan_shadow_Nbyte_markvalid().

Here is the call graph for this function:

◆ __asan_unregister_globals()

void __asan_unregister_globals ( struct __asan_global globals,
size_t  n 
)

Definition at line 1031 of file subr_asan.c.

References kasan_mark().

Here is the call graph for this function:

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ ASAN_ATOMIC_FUNC_ADD() [1/7]

ASAN_ATOMIC_FUNC_ADD ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_ADD() [2/7]

ASAN_ATOMIC_FUNC_ADD ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_ADD() [3/7]

ASAN_ATOMIC_FUNC_ADD ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_ADD() [4/7]

ASAN_ATOMIC_FUNC_ADD ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_ADD() [5/7]

ASAN_ATOMIC_FUNC_ADD ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_ADD() [6/7]

ASAN_ATOMIC_FUNC_ADD ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_ADD() [7/7]

ASAN_ATOMIC_FUNC_ADD ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [1/7]

ASAN_ATOMIC_FUNC_CLEAR ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [2/7]

ASAN_ATOMIC_FUNC_CLEAR ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [3/7]

ASAN_ATOMIC_FUNC_CLEAR ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [4/7]

ASAN_ATOMIC_FUNC_CLEAR ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [5/7]

ASAN_ATOMIC_FUNC_CLEAR ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [6/7]

ASAN_ATOMIC_FUNC_CLEAR ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_CLEAR() [7/7]

ASAN_ATOMIC_FUNC_CLEAR ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [1/7]

ASAN_ATOMIC_FUNC_CMPSET ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [2/7]

ASAN_ATOMIC_FUNC_CMPSET ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [3/7]

ASAN_ATOMIC_FUNC_CMPSET ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [4/7]

ASAN_ATOMIC_FUNC_CMPSET ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [5/7]

ASAN_ATOMIC_FUNC_CMPSET ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [6/7]

ASAN_ATOMIC_FUNC_CMPSET ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_CMPSET() [7/7]

ASAN_ATOMIC_FUNC_CMPSET ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [1/7]

ASAN_ATOMIC_FUNC_FCMPSET ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [2/7]

ASAN_ATOMIC_FUNC_FCMPSET ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [3/7]

ASAN_ATOMIC_FUNC_FCMPSET ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [4/7]

ASAN_ATOMIC_FUNC_FCMPSET ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [5/7]

ASAN_ATOMIC_FUNC_FCMPSET ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [6/7]

ASAN_ATOMIC_FUNC_FCMPSET ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_FCMPSET() [7/7]

ASAN_ATOMIC_FUNC_FCMPSET ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_FETCHADD() [1/4]

ASAN_ATOMIC_FUNC_FETCHADD ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_FETCHADD() [2/4]

ASAN_ATOMIC_FUNC_FETCHADD ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_FETCHADD() [3/4]

ASAN_ATOMIC_FUNC_FETCHADD ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_FETCHADD() [4/4]

ASAN_ATOMIC_FUNC_FETCHADD ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [1/9]

ASAN_ATOMIC_FUNC_LOAD ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [2/9]

ASAN_ATOMIC_FUNC_LOAD ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [3/9]

ASAN_ATOMIC_FUNC_LOAD ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [4/9]

ASAN_ATOMIC_FUNC_LOAD ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [5/9]

ASAN_ATOMIC_FUNC_LOAD ( char  ,
u_char   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [6/9]

ASAN_ATOMIC_FUNC_LOAD ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [7/9]

ASAN_ATOMIC_FUNC_LOAD ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [8/9]

ASAN_ATOMIC_FUNC_LOAD ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_LOAD() [9/9]

ASAN_ATOMIC_FUNC_LOAD ( short  ,
u_short   
)

◆ ASAN_ATOMIC_FUNC_READANDCLEAR() [1/5]

ASAN_ATOMIC_FUNC_READANDCLEAR ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_READANDCLEAR() [2/5]

ASAN_ATOMIC_FUNC_READANDCLEAR ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_READANDCLEAR() [3/5]

ASAN_ATOMIC_FUNC_READANDCLEAR ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_READANDCLEAR() [4/5]

ASAN_ATOMIC_FUNC_READANDCLEAR ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_READANDCLEAR() [5/5]

ASAN_ATOMIC_FUNC_READANDCLEAR ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_SET() [1/7]

ASAN_ATOMIC_FUNC_SET ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_SET() [2/7]

ASAN_ATOMIC_FUNC_SET ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_SET() [3/7]

ASAN_ATOMIC_FUNC_SET ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_SET() [4/7]

ASAN_ATOMIC_FUNC_SET ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_SET() [5/7]

ASAN_ATOMIC_FUNC_SET ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_SET() [6/7]

ASAN_ATOMIC_FUNC_SET ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_SET() [7/7]

ASAN_ATOMIC_FUNC_SET ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_STORE() [1/9]

ASAN_ATOMIC_FUNC_STORE ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_STORE() [2/9]

ASAN_ATOMIC_FUNC_STORE ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_STORE() [3/9]

ASAN_ATOMIC_FUNC_STORE ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_STORE() [4/9]

ASAN_ATOMIC_FUNC_STORE ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_STORE() [5/9]

ASAN_ATOMIC_FUNC_STORE ( char  ,
u_char   
)

◆ ASAN_ATOMIC_FUNC_STORE() [6/9]

ASAN_ATOMIC_FUNC_STORE ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_STORE() [7/9]

ASAN_ATOMIC_FUNC_STORE ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_STORE() [8/9]

ASAN_ATOMIC_FUNC_STORE ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_STORE() [9/9]

ASAN_ATOMIC_FUNC_STORE ( short  ,
u_short   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [1/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( 16  ,
uint16_t   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [2/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [3/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [4/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( ,
uint8_t   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [5/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [6/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_SUBTRACT() [7/7]

ASAN_ATOMIC_FUNC_SUBTRACT ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_SWAP() [1/5]

ASAN_ATOMIC_FUNC_SWAP ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_SWAP() [2/5]

ASAN_ATOMIC_FUNC_SWAP ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_SWAP() [3/5]

ASAN_ATOMIC_FUNC_SWAP ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_SWAP() [4/5]

ASAN_ATOMIC_FUNC_SWAP ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_SWAP() [5/5]

ASAN_ATOMIC_FUNC_SWAP ( ptr  ,
uintptr_t   
)

◆ ASAN_ATOMIC_FUNC_TESTANDCLEAR() [1/4]

ASAN_ATOMIC_FUNC_TESTANDCLEAR ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_TESTANDCLEAR() [2/4]

ASAN_ATOMIC_FUNC_TESTANDCLEAR ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_TESTANDCLEAR() [3/4]

ASAN_ATOMIC_FUNC_TESTANDCLEAR ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_TESTANDCLEAR() [4/4]

ASAN_ATOMIC_FUNC_TESTANDCLEAR ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_TESTANDSET() [1/4]

ASAN_ATOMIC_FUNC_TESTANDSET ( 32  ,
uint32_t   
)

◆ ASAN_ATOMIC_FUNC_TESTANDSET() [2/4]

ASAN_ATOMIC_FUNC_TESTANDSET ( 64  ,
uint64_t   
)

◆ ASAN_ATOMIC_FUNC_TESTANDSET() [3/4]

ASAN_ATOMIC_FUNC_TESTANDSET ( int  ,
u_int   
)

◆ ASAN_ATOMIC_FUNC_TESTANDSET() [4/4]

ASAN_ATOMIC_FUNC_TESTANDSET ( long  ,
u_long   
)

◆ ASAN_ATOMIC_FUNC_THREAD_FENCE() [1/4]

ASAN_ATOMIC_FUNC_THREAD_FENCE ( acq  )

◆ ASAN_ATOMIC_FUNC_THREAD_FENCE() [2/4]

ASAN_ATOMIC_FUNC_THREAD_FENCE ( acq_rel  )

◆ ASAN_ATOMIC_FUNC_THREAD_FENCE() [3/4]

ASAN_ATOMIC_FUNC_THREAD_FENCE ( rel  )

◆ ASAN_ATOMIC_FUNC_THREAD_FENCE() [4/4]

ASAN_ATOMIC_FUNC_THREAD_FENCE ( seq_cst  )

◆ ASAN_LOAD_STORE() [1/5]

ASAN_LOAD_STORE ( )

◆ ASAN_LOAD_STORE() [2/5]

ASAN_LOAD_STORE ( 16  )

◆ ASAN_LOAD_STORE() [3/5]

ASAN_LOAD_STORE ( )

◆ ASAN_LOAD_STORE() [4/5]

ASAN_LOAD_STORE ( )

◆ ASAN_LOAD_STORE() [5/5]

ASAN_LOAD_STORE ( )

◆ ASAN_SET_SHADOW() [1/6]

ASAN_SET_SHADOW ( 00  )

◆ ASAN_SET_SHADOW() [2/6]

ASAN_SET_SHADOW ( f1  )

◆ ASAN_SET_SHADOW() [3/6]

ASAN_SET_SHADOW ( f2  )

◆ ASAN_SET_SHADOW() [4/6]

ASAN_SET_SHADOW ( f3  )

◆ ASAN_SET_SHADOW() [5/6]

ASAN_SET_SHADOW ( f5  )

◆ ASAN_SET_SHADOW() [6/6]

ASAN_SET_SHADOW ( f8  )

◆ FEATURE()

FEATURE ( kasan  ,
"Kernel address sanitizer"   
)

◆ kasan_atomic_interrupt_fence()

void kasan_atomic_interrupt_fence ( void  )

Definition at line 862 of file subr_asan.c.

◆ kasan_bus_space_barrier()

void kasan_bus_space_barrier ( bus_space_tag_t  tag,
bus_space_handle_t  hnd,
bus_size_t  offset,
bus_size_t  size,
int  flags 
)

Definition at line 901 of file subr_asan.c.

References flags.

◆ kasan_bus_space_free()

void kasan_bus_space_free ( bus_space_tag_t  tag,
bus_space_handle_t  hnd,
bus_size_t  size 
)

Definition at line 894 of file subr_asan.c.

◆ kasan_bus_space_map()

int kasan_bus_space_map ( bus_space_tag_t  tag,
bus_addr_t  hnd,
bus_size_t  size,
int  flags,
bus_space_handle_t *  handlep 
)

Definition at line 873 of file subr_asan.c.

References flags.

◆ kasan_bus_space_subregion()

int kasan_bus_space_subregion ( bus_space_tag_t  tag,
bus_space_handle_t  hnd,
bus_size_t  offset,
bus_size_t  size,
bus_space_handle_t *  handlep 
)

Definition at line 887 of file subr_asan.c.

◆ kasan_bus_space_unmap()

void kasan_bus_space_unmap ( bus_space_tag_t  tag,
bus_space_handle_t  hnd,
bus_size_t  size 
)

Definition at line 880 of file subr_asan.c.

◆ kasan_casueword()

int kasan_casueword ( volatile u_long *  base,
u_long  oldval,
u_long *  oldvalp,
u_long  newval 
)

Definition at line 598 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_casueword32()

int kasan_casueword32 ( volatile uint32_t *  base,
uint32_t  oldval,
uint32_t *  oldvalp,
uint32_t  newval 
)

Definition at line 589 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_code_name()

static const char * kasan_code_name ( uint8_t  code)
inlinestatic

Definition at line 143 of file subr_asan.c.

Referenced by kasan_report().

Here is the caller graph for this function:

◆ kasan_copyin()

int kasan_copyin ( const void *  uaddr,
void *  kaddr,
size_t  len 
)

Definition at line 503 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_copyinstr()

int kasan_copyinstr ( const void *  uaddr,
void *  kaddr,
size_t  len,
size_t *  done 
)

Definition at line 510 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_copyout()

int kasan_copyout ( const void *  kaddr,
void *  uaddr,
size_t  len 
)

Definition at line 517 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_fubyte()

int kasan_fubyte ( volatile const void *  base)

Definition at line 526 of file subr_asan.c.

◆ kasan_fueword()

int kasan_fueword ( volatile const void *  base,
long *  val 
)

Definition at line 538 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_fueword32()

int kasan_fueword32 ( volatile const void *  base,
int32_t *  val 
)

Definition at line 545 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_fueword64()

int kasan_fueword64 ( volatile const void *  base,
int64_t *  val 
)

Definition at line 552 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_fuword16()

int kasan_fuword16 ( volatile const void *  base)

Definition at line 532 of file subr_asan.c.

◆ kasan_init()

void kasan_init ( void  )

Definition at line 126 of file subr_asan.c.

◆ kasan_mark()

void kasan_mark ( const void *  addr,
size_t  size,
size_t  redzsize,
uint8_t  code 
)

◆ kasan_memcmp()

int kasan_memcmp ( const void *  b1,
const void *  b2,
size_t  len 
)

Definition at line 431 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_memcpy()

void * kasan_memcpy ( void *  dst,
const void *  src,
size_t  len 
)

Definition at line 423 of file subr_asan.c.

References __RET_ADDR, kasan_shadow_check(), and src.

Here is the call graph for this function:

◆ kasan_memmove()

void * kasan_memmove ( void *  dst,
const void *  src,
size_t  len 
)

Definition at line 446 of file subr_asan.c.

References __RET_ADDR, kasan_shadow_check(), and src.

Here is the call graph for this function:

◆ kasan_memset()

void * kasan_memset ( void *  b,
int  c,
size_t  len 
)

Definition at line 439 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_report()

static void kasan_report ( unsigned long  addr,
size_t  size,
bool  write,
unsigned long  pc,
uint8_t  code 
)
static

Definition at line 189 of file subr_asan.c.

References addr, kasan_code_name(), and REPORT.

Referenced by kasan_shadow_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kasan_shadow_1byte_isvalid()

static __always_inline bool kasan_shadow_1byte_isvalid ( unsigned long  addr,
uint8_t *  code 
)
static

Definition at line 292 of file subr_asan.c.

References addr, and KASAN_SHADOW_MASK.

Referenced by kasan_shadow_2byte_isvalid(), kasan_shadow_check(), and kasan_shadow_Nbyte_isvalid().

Here is the caller graph for this function:

◆ kasan_shadow_1byte_markvalid()

static __always_inline void kasan_shadow_1byte_markvalid ( unsigned long  addr)
static

Definition at line 198 of file subr_asan.c.

References addr, and KASAN_SHADOW_MASK.

Referenced by kasan_shadow_Nbyte_markvalid().

Here is the caller graph for this function:

◆ kasan_shadow_2byte_isvalid()

static __always_inline bool kasan_shadow_2byte_isvalid ( unsigned long  addr,
uint8_t *  code 
)
static

Definition at line 305 of file subr_asan.c.

References addr, ADDR_CROSSES_SCALE_BOUNDARY, kasan_shadow_1byte_isvalid(), and KASAN_SHADOW_MASK.

Referenced by kasan_shadow_4byte_isvalid(), and kasan_shadow_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kasan_shadow_4byte_isvalid()

static __always_inline bool kasan_shadow_4byte_isvalid ( unsigned long  addr,
uint8_t *  code 
)
static

Definition at line 325 of file subr_asan.c.

References addr, ADDR_CROSSES_SCALE_BOUNDARY, kasan_shadow_2byte_isvalid(), and KASAN_SHADOW_MASK.

Referenced by kasan_shadow_8byte_isvalid(), and kasan_shadow_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kasan_shadow_8byte_isvalid()

static __always_inline bool kasan_shadow_8byte_isvalid ( unsigned long  addr,
uint8_t *  code 
)
static

Definition at line 345 of file subr_asan.c.

References addr, ADDR_CROSSES_SCALE_BOUNDARY, kasan_shadow_4byte_isvalid(), and KASAN_SHADOW_MASK.

Referenced by kasan_shadow_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kasan_shadow_check()

static __always_inline void kasan_shadow_check ( unsigned long  addr,
size_t  size,
bool  write,
unsigned long  retaddr 
)
static

◆ kasan_shadow_map()

void kasan_shadow_map ( vm_offset_t  addr,
size_t  size 
)

Definition at line 100 of file subr_asan.c.

References addr.

◆ kasan_shadow_Nbyte_fill()

static __always_inline void kasan_shadow_Nbyte_fill ( const void *  addr,
size_t  size,
uint8_t  code 
)
static

Definition at line 217 of file subr_asan.c.

References addr.

Referenced by __asan_alloca_poison(), __asan_allocas_unpoison(), and __asan_poison_stack_memory().

Here is the caller graph for this function:

◆ kasan_shadow_Nbyte_isvalid()

static __always_inline bool kasan_shadow_Nbyte_isvalid ( unsigned long  addr,
size_t  size,
uint8_t *  code 
)
static

Definition at line 365 of file subr_asan.c.

References addr, and kasan_shadow_1byte_isvalid().

Referenced by kasan_shadow_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kasan_shadow_Nbyte_markvalid()

static __always_inline void kasan_shadow_Nbyte_markvalid ( const void *  addr,
size_t  size 
)
static

Definition at line 207 of file subr_asan.c.

References addr, and kasan_shadow_1byte_markvalid().

Referenced by __asan_unpoison_stack_memory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kasan_strcmp()

int kasan_strcmp ( const char *  s1,
const char *  s2 
)

Definition at line 487 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_strcpy()

char * kasan_strcpy ( char *  dst,
const char *  src 
)

Definition at line 470 of file subr_asan.c.

References __RET_ADDR, kasan_shadow_check(), and src.

Here is the call graph for this function:

◆ kasan_strlen()

size_t kasan_strlen ( const char *  str)

Definition at line 454 of file subr_asan.c.

References __RET_ADDR, and kasan_shadow_check().

Here is the call graph for this function:

◆ kasan_subyte()

int kasan_subyte ( volatile void *  base,
int  byte 
)

Definition at line 559 of file subr_asan.c.

◆ kasan_suword()

int kasan_suword ( volatile void *  base,
long  word 
)

Definition at line 565 of file subr_asan.c.

◆ kasan_suword16()

int kasan_suword16 ( volatile void *  base,
int  word 
)

Definition at line 571 of file subr_asan.c.

◆ kasan_suword32()

int kasan_suword32 ( volatile void *  base,
int32_t  word 
)

Definition at line 577 of file subr_asan.c.

◆ kasan_suword64()

int kasan_suword64 ( volatile void *  base,
int64_t  word 
)

Definition at line 583 of file subr_asan.c.

◆ SYSCTL_INT()

SYSCTL_INT ( _debug_kasan  ,
OID_AUTO  ,
panic_on_violation  ,
CTLFLAG_RDTUN  ,
panic_on_violation,
,
"Panic if an invalid access is detected"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _debug  ,
OID_AUTO  ,
kasan  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"KASAN options"   
)
static

Variable Documentation

◆ __read_mostly

bool kasan_enabled __read_mostly = false
static

Definition at line 95 of file subr_asan.c.

◆ panic_on_violation

int panic_on_violation = 1
static

Definition at line 90 of file subr_asan.c.