History log of /freebsd-current/sys/sys/atomic_san.h
Revision Date Author Comments
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 08b0c980 09-Feb-2023 Mark Johnston <markj@FreeBSD.org>

atomic: Fix the atomic_load_ptr() *SAN interceptor

The interceptor didn't handle a pointer of type "foo * const *" and in
that case we'd get compiler errors 1) an invalid cast to volatile
uintptr_t, and 2) an assignment to a variable of type "foo * const"
(__retptr).

Reported by: mjg
MFC after: 1 week


# f7e2f98b 16-Jan-2023 Mark Johnston <markj@FreeBSD.org>

atomic: Remove cdefs.h includes from atomic_*.h

Avoid including cdefs.h in system headers. Both headers now include
types.h, and we can assume that that pulls in cdefs.h (required for
__typeof usage in some of the atomic macro expansions).

No functional change intended.

Reviewed by: imp, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38039


# 6ebd8466 03-Jan-2023 Mark Johnston <markj@FreeBSD.org>

atomic: Make atomic_san.h self-contained

This file assumes that uint*_t and __typeof() are defined, so ensure
that consumers don't have to pull in the requisite includes themselves.
This is consistent with sys/atomic_common.h.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37939


# 1f6b6cf1 29-Oct-2022 Mark Johnston <markj@FreeBSD.org>

atomic: Intercept atomic_(load|store)_bool for kernel sanitizers

Fixes: 2bed73739aac ("atomic: Add plain atomic_load/store_bool()")


# 45cb7671 15-Sep-2021 John Baldwin <jhb@FreeBSD.org>

Only define sanitizer wrappers for atomic fences once.

Previously, this was defining duplicate definitions for each type.

This fixes a redundat definition warning from GCC.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31965


# a90d053b 19-Jul-2021 Mark Johnston <markj@FreeBSD.org>

Simplify kernel sanitizer interceptors

KASAN and KCSAN implement interceptors for various primitive operations
that are not instrumented by the compiler. KMSAN requires them as well.
Rather than adding new cases for each sanitizer which requires
interceptors, implement the following protocol:
- When interceptor definitions are required, define
SAN_NEEDS_INTERCEPTORS and SANITIZER_INTERCEPTOR_PREFIX.
- In headers that declare functions which need to be intercepted by a
sanitizer runtime, use SANITIZER_INTERCEPTOR_PREFIX to provide
declarations.
- When SAN_RUNTIME is defined, do not redefine the names of intercepted
functions. This is typically the case in files which implement
sanitizer runtimes but is also needed in, for example, files which
define ifunc selectors for intercepted operations.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# 3ead6023 22-Mar-2021 Mark Johnston <markj@FreeBSD.org>

Generalize bus_space(9) and atomic(9) sanitizer interceptors

Make it easy to define interceptors for new sanitizer runtimes, rather
than assuming KCSAN. Lay a bit of groundwork for KASAN and KMSAN.

When a sanitizer is compiled in, atomic(9) and bus_space(9) definitions
in atomic_san.h are used by default instead of the inline
implementations in the platform's atomic.h. These definitions are
implemented in the sanitizer runtime, which includes
machine/{atomic,bus}.h with SAN_RUNTIME defined to pull in the actual
implementations.

No functional change intended.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 435c7cfb 07-Mar-2021 Mark Johnston <markj@FreeBSD.org>

Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h

Other kernel sanitizers (KMSAN, KASAN) require interceptors as well, so
put these in a more generic place as a step towards importing the other
sanitizers.

No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29103