From e95c204297607d3e81aa2d8d964fc84a0015b333 Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 21 Nov 2019 13:22:23 +0000 Subject: [PATCH] Add kcsan_md_unsupported from NetBSD. It's used to ignore virtual addresses that may have a different physical address depending on the CPU. Sponsored by: DARPA, AFRL --- sys/amd64/include/csan.h | 6 ++++++ sys/arm64/include/csan.h | 6 ++++++ sys/kern/subr_csan.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/sys/amd64/include/csan.h b/sys/amd64/include/csan.h index 43c37dd1a541..c886daa12f69 100644 --- a/sys/amd64/include/csan.h +++ b/sys/amd64/include/csan.h @@ -35,6 +35,12 @@ #include #include +static inline bool +kcsan_md_unsupported(vm_offset_t addr) +{ + return false; +} + static inline bool kcsan_md_is_avail(void) { diff --git a/sys/arm64/include/csan.h b/sys/arm64/include/csan.h index ddcd5972d06f..bace3866eb66 100644 --- a/sys/arm64/include/csan.h +++ b/sys/arm64/include/csan.h @@ -35,6 +35,12 @@ #include #include +static inline bool +kcsan_md_unsupported(vm_offset_t addr) +{ + return false; +} + static inline bool kcsan_md_is_avail(void) { diff --git a/sys/kern/subr_csan.c b/sys/kern/subr_csan.c index b53bf4d74f01..e01dfb1c6293 100644 --- a/sys/kern/subr_csan.c +++ b/sys/kern/subr_csan.c @@ -151,6 +151,8 @@ kcsan_access(uintptr_t addr, size_t size, bool write, bool atomic, uintptr_t pc) if (__predict_false(!kcsan_enabled)) return; + if (__predict_false(kcsan_md_unsupported((vm_offset_t)addr))) + return; new.addr = addr; new.size = size;