FreeBSD kernel kern code
|
#include "opt_ddb.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/cpu.h>
#include <sys/csan.h>
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/systm.h>
#include <ddb/ddb.h>
#include <ddb/db_sym.h>
#include <machine/csan.h>
#include <machine/atomic.h>
#include <sys/atomic_san.h>
#include <machine/bus.h>
#include <sys/bus_san.h>
Go to the source code of this file.
Data Structures | |
struct | csan_cell_t |
struct | csan_cpu_t |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | kcsan_enable (void *dummy __unused) |
SYSINIT (kcsan_enable, SI_SUB_SMP, SI_ORDER_SECOND, kcsan_enable, NULL) | |
void | kcsan_cpu_init (u_int cpu) |
static void | kcsan_report (csan_cell_t *new, u_int newcpu, csan_cell_t *old, u_int oldcpu) |
static bool | kcsan_access_is_atomic (csan_cell_t *new, csan_cell_t *old) |
static void | kcsan_access (uintptr_t addr, size_t size, bool write, bool atomic, uintptr_t pc) |
void | __tsan_read_range (uintptr_t, size_t) |
void | __tsan_write_range (uintptr_t, size_t) |
void | __tsan_init (void) |
void | __tsan_func_entry (void *) |
void | __tsan_func_exit (void) |
void * | kcsan_memcpy (void *dst, const void *src, size_t len) |
int | kcsan_memcmp (const void *b1, const void *b2, size_t len) |
void * | kcsan_memset (void *b, int c, size_t len) |
void * | kcsan_memmove (void *dst, const void *src, size_t len) |
char * | kcsan_strcpy (char *dst, const char *src) |
int | kcsan_strcmp (const char *s1, const char *s2) |
size_t | kcsan_strlen (const char *str) |
int | kcsan_copyin (const void *uaddr, void *kaddr, size_t len) |
int | kcsan_copyinstr (const void *uaddr, void *kaddr, size_t len, size_t *done) |
int | kcsan_copyout (const void *kaddr, void *uaddr, size_t len) |
void | kcsan_atomic_interrupt_fence (void) |
int | kcsan_bus_space_map (bus_space_tag_t tag, bus_addr_t hnd, bus_size_t size, int flags, bus_space_handle_t *handlep) |
void | kcsan_bus_space_unmap (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t size) |
int | kcsan_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) |
int | kcsan_bus_space_alloc (bus_space_tag_t tag, bus_addr_t reg_start, bus_addr_t reg_end, bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *handlep) |
void | kcsan_bus_space_free (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t size) |
void | kcsan_bus_space_barrier (bus_space_tag_t tag, bus_space_handle_t hnd, bus_size_t offset, bus_size_t size, int flags) |
Variables | |
static csan_cpu_t | kcsan_cpus [MAXCPU] |
static bool kcsan_enabled | __read_mostly |
#define __RET_ADDR (uintptr_t)__builtin_return_address(0) |
Definition at line 76 of file subr_csan.c.
Definition at line 379 of file subr_csan.c.
Definition at line 392 of file subr_csan.c.
Definition at line 405 of file subr_csan.c.
Definition at line 419 of file subr_csan.c.
Definition at line 441 of file subr_csan.c.
Definition at line 461 of file subr_csan.c.
Definition at line 487 of file subr_csan.c.
Definition at line 474 of file subr_csan.c.
Definition at line 387 of file subr_csan.c.
Definition at line 400 of file subr_csan.c.
Definition at line 414 of file subr_csan.c.
Definition at line 428 of file subr_csan.c.
Definition at line 433 of file subr_csan.c.
Definition at line 449 of file subr_csan.c.
Definition at line 453 of file subr_csan.c.
Definition at line 469 of file subr_csan.c.
Definition at line 495 of file subr_csan.c.
Definition at line 482 of file subr_csan.c.
Definition at line 499 of file subr_csan.c.
Definition at line 507 of file subr_csan.c.
Definition at line 515 of file subr_csan.c.
#define CSAN_ATOMIC_FUNC_THREAD_FENCE | ( | name | ) |
Definition at line 662 of file subr_csan.c.
#define CSAN_BUS_PEEK_FUNC | ( | width, | |
type | |||
) |
Definition at line 874 of file subr_csan.c.
#define CSAN_BUS_POKE_FUNC | ( | width, | |
type | |||
) |
Definition at line 890 of file subr_csan.c.
#define CSAN_BUS_READ_FUNC | ( | func, | |
width, | |||
type | |||
) |
Definition at line 738 of file subr_csan.c.
#define CSAN_BUS_READ_PTR_FUNC | ( | func, | |
width, | |||
type | |||
) |
Definition at line 746 of file subr_csan.c.
#define CSAN_BUS_SET_FUNC | ( | func, | |
width, | |||
type | |||
) |
#define CSAN_BUS_WRITE_FUNC | ( | func, | |
width, | |||
type | |||
) |
Definition at line 787 of file subr_csan.c.
#define CSAN_BUS_WRITE_PTR_FUNC | ( | func, | |
width, | |||
type | |||
) |
Definition at line 794 of file subr_csan.c.
#define CSAN_READ | ( | size | ) |
Definition at line 201 of file subr_csan.c.
#define CSAN_WRITE | ( | size | ) |
Definition at line 219 of file subr_csan.c.
#define KCSAN_DELAY 10 /* 10 microseconds */ |
Definition at line 79 of file subr_csan.c.
#define KCSAN_NACCESSES 1024 |
Definition at line 78 of file subr_csan.c.
#define REPORT printf |
Definition at line 56 of file subr_csan.c.
#define SAN_RUNTIME |
Definition at line 33 of file subr_csan.c.
__FBSDID | ( | "$FreeBSD$" | ) |
void __tsan_func_entry | ( | void * | call_pc | ) |
Definition at line 262 of file subr_csan.c.
void __tsan_func_exit | ( | void | ) |
Definition at line 267 of file subr_csan.c.
void __tsan_init | ( | void | ) |
Definition at line 257 of file subr_csan.c.
void __tsan_read_range | ( | uintptr_t | addr, |
size_t | size | ||
) |
Definition at line 241 of file subr_csan.c.
References __RET_ADDR, addr, and kcsan_access().
void __tsan_write_range | ( | uintptr_t | addr, |
size_t | size | ||
) |
Definition at line 247 of file subr_csan.c.
References __RET_ADDR, addr, and kcsan_access().
|
inlinestatic |
Definition at line 145 of file subr_csan.c.
References addr, csan_cell_t::addr, csan_cpu_t::cell, csan_cpu_t::cnt, csan_cpu_t::inited, kcsan_access_is_atomic(), kcsan_cpus, KCSAN_DELAY, KCSAN_NACCESSES, kcsan_report(), csan_cell_t::size, and csan_cell_t::write.
Referenced by __tsan_read_range(), __tsan_write_range(), kcsan_copyin(), kcsan_copyinstr(), kcsan_copyout(), kcsan_memcmp(), kcsan_memcpy(), kcsan_memmove(), kcsan_memset(), kcsan_strcmp(), kcsan_strcpy(), and kcsan_strlen().
|
inlinestatic |
Definition at line 135 of file subr_csan.c.
References csan_cell_t::atomic, and csan_cell_t::write.
Referenced by kcsan_access().
void kcsan_atomic_interrupt_fence | ( | void | ) |
Definition at line 674 of file subr_csan.c.
int kcsan_bus_space_alloc | ( | bus_space_tag_t | tag, |
bus_addr_t | reg_start, | ||
bus_addr_t | reg_end, | ||
bus_size_t | size, | ||
bus_size_t | alignment, | ||
bus_size_t | boundary, | ||
int | flags, | ||
bus_addr_t * | addrp, | ||
bus_space_handle_t * | handlep | ||
) |
Definition at line 711 of file subr_csan.c.
References flags.
void kcsan_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 731 of file subr_csan.c.
References flags.
void kcsan_bus_space_free | ( | bus_space_tag_t | tag, |
bus_space_handle_t | hnd, | ||
bus_size_t | size | ||
) |
Definition at line 723 of file subr_csan.c.
int kcsan_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 686 of file subr_csan.c.
References flags.
int kcsan_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 702 of file subr_csan.c.
void kcsan_bus_space_unmap | ( | bus_space_tag_t | tag, |
bus_space_handle_t | hnd, | ||
bus_size_t | size | ||
) |
Definition at line 694 of file subr_csan.c.
int kcsan_copyin | ( | const void * | uaddr, |
void * | kaddr, | ||
size_t | len | ||
) |
Definition at line 354 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
int kcsan_copyinstr | ( | const void * | uaddr, |
void * | kaddr, | ||
size_t | len, | ||
size_t * | done | ||
) |
Definition at line 361 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
int kcsan_copyout | ( | const void * | kaddr, |
void * | uaddr, | ||
size_t | len | ||
) |
Definition at line 368 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
void kcsan_cpu_init | ( | u_int | cpu | ) |
Definition at line 98 of file subr_csan.c.
References csan_cpu_t::inited, and kcsan_cpus.
|
static |
Definition at line 89 of file subr_csan.c.
References printf().
int kcsan_memcmp | ( | const void * | b1, |
const void * | b2, | ||
size_t | len | ||
) |
Definition at line 282 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
void * kcsan_memcpy | ( | void * | dst, |
const void * | src, | ||
size_t | len | ||
) |
Definition at line 274 of file subr_csan.c.
References __RET_ADDR, kcsan_access(), and src.
void * kcsan_memmove | ( | void * | dst, |
const void * | src, | ||
size_t | len | ||
) |
Definition at line 297 of file subr_csan.c.
References __RET_ADDR, kcsan_access(), and src.
void * kcsan_memset | ( | void * | b, |
int | c, | ||
size_t | len | ||
) |
Definition at line 290 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
|
inlinestatic |
Definition at line 106 of file subr_csan.c.
References csan_cell_t::addr, csan_cell_t::atomic, csan_cell_t::pc, REPORT, csan_cell_t::size, sym, and csan_cell_t::write.
Referenced by kcsan_access().
int kcsan_strcmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Definition at line 322 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
char * kcsan_strcpy | ( | char * | dst, |
const char * | src | ||
) |
Definition at line 305 of file subr_csan.c.
References __RET_ADDR, kcsan_access(), and src.
size_t kcsan_strlen | ( | const char * | str | ) |
Definition at line 338 of file subr_csan.c.
References __RET_ADDR, and kcsan_access().
SYSINIT | ( | kcsan_enable | , |
SI_SUB_SMP | , | ||
SI_ORDER_SECOND | , | ||
kcsan_enable | , | ||
NULL | |||
) |
|
static |
Definition at line 74 of file subr_csan.c.
|
static |
Definition at line 73 of file subr_csan.c.
Referenced by kcsan_access(), and kcsan_cpu_init().