mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:40:53 +07:00
locking/atomics, kcsan: Add KCSAN instrumentation
This adds KCSAN instrumentation to atomic-instrumented.h. Signed-off-by: Marco Elver <elver@google.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
bf07132f96
commit
e75a6795ed
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ gen_param_check()
|
|||||||
# We don't write to constant parameters
|
# We don't write to constant parameters
|
||||||
[ ${type#c} != ${type} ] && rw="read"
|
[ ${type#c} != ${type} ] && rw="read"
|
||||||
|
|
||||||
printf "\tkasan_check_${rw}(${name}, sizeof(*${name}));\n"
|
printf "\t__atomic_check_${rw}(${name}, sizeof(*${name}));\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
#gen_param_check(arg...)
|
#gen_param_check(arg...)
|
||||||
@ -107,7 +107,7 @@ cat <<EOF
|
|||||||
#define ${xchg}(ptr, ...) \\
|
#define ${xchg}(ptr, ...) \\
|
||||||
({ \\
|
({ \\
|
||||||
typeof(ptr) __ai_ptr = (ptr); \\
|
typeof(ptr) __ai_ptr = (ptr); \\
|
||||||
kasan_check_write(__ai_ptr, ${mult}sizeof(*__ai_ptr)); \\
|
__atomic_check_write(__ai_ptr, ${mult}sizeof(*__ai_ptr)); \\
|
||||||
arch_${xchg}(__ai_ptr, __VA_ARGS__); \\
|
arch_${xchg}(__ai_ptr, __VA_ARGS__); \\
|
||||||
})
|
})
|
||||||
EOF
|
EOF
|
||||||
@ -148,6 +148,19 @@ cat << EOF
|
|||||||
|
|
||||||
#include <linux/build_bug.h>
|
#include <linux/build_bug.h>
|
||||||
#include <linux/kasan-checks.h>
|
#include <linux/kasan-checks.h>
|
||||||
|
#include <linux/kcsan-checks.h>
|
||||||
|
|
||||||
|
static inline void __atomic_check_read(const volatile void *v, size_t size)
|
||||||
|
{
|
||||||
|
kasan_check_read(v, size);
|
||||||
|
kcsan_check_atomic_read(v, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __atomic_check_write(const volatile void *v, size_t size)
|
||||||
|
{
|
||||||
|
kasan_check_write(v, size);
|
||||||
|
kcsan_check_atomic_write(v, size);
|
||||||
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user