History

asm-generic, atomic-instrumented: Use generic instrumented.h

This switches atomic-instrumented.h to use the generic instrumentation wrappers provided by instrumented.h. No functional change intended.

Marco Elver committed 6 years ago

Commit ed8af2e1 parent 36e4d4d2 files · +194 −220Browse files

Showing the changes to scripts (1 of 2 files). Show all

Unified · Split

scripts/atomic/gen-atomic-instrumented.sh+3−16
@@ -20,7 +20,7 @@ gen_param_check() · 19 unmodified lines
20 # We don't write to constant parameters20 # We don't write to constant parameters
21 [ ${type#c} != ${type} ] && rw="read"21 [ ${type#c} != ${type} ] && rw="read"
22 22
23 printf "\t__atomic_check_${rw}(${name}, sizeof(*${name}));\n"23 printf "\tinstrument_atomic_${rw}(${name}, sizeof(*${name}));\n"
24}24}
25 25
26#gen_param_check(arg...)26#gen_param_check(arg...)
@@ -107,7 +107,7 @@ cat <<EOF · 80 unmodified lines
107#define ${xchg}(ptr, ...) \\107#define ${xchg}(ptr, ...) \\
108({ \\108({ \\
109 typeof(ptr) __ai_ptr = (ptr); \\109 typeof(ptr) __ai_ptr = (ptr); \\
110 __atomic_check_write(__ai_ptr, ${mult}sizeof(*__ai_ptr)); \\110 instrument_atomic_write(__ai_ptr, ${mult}sizeof(*__ai_ptr)); \\
111 arch_${xchg}(__ai_ptr, __VA_ARGS__); \\111 arch_${xchg}(__ai_ptr, __VA_ARGS__); \\
112})112})
113EOF113EOF
@@ -148,20 +148,7 @@ cat << EOF · 34 unmodified lines
148 148
149#include <linux/build_bug.h>149#include <linux/build_bug.h>
150#include <linux/compiler.h>150#include <linux/compiler.h>
151#include <linux/kasan-checks.h>151#include <linux/instrumented.h>
152#include <linux/kcsan-checks.h>
153
154static __always_inline void __atomic_check_read(const volatile void *v, size_t size)
155{
156 kasan_check_read(v, size);
157 kcsan_check_atomic_read(v, size);
158}
159
160static __always_inline void __atomic_check_write(const volatile void *v, size_t size)
161{
162 kasan_check_write(v, size);
163 kcsan_check_atomic_write(v, size);
164}
165 152
166EOF153EOF
167 154