Commit 9d1335cc authored by Marco Elver's avatar Marco Elver Committed by Paul E. McKenney

kcsan: Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks

Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks for the builtin atomics
instrumentation.
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 106a307f
...@@ -914,14 +914,19 @@ EXPORT_SYMBOL(__tsan_init); ...@@ -914,14 +914,19 @@ EXPORT_SYMBOL(__tsan_init);
u##bits __tsan_atomic##bits##_load(const u##bits *ptr, int memorder); \ u##bits __tsan_atomic##bits##_load(const u##bits *ptr, int memorder); \
u##bits __tsan_atomic##bits##_load(const u##bits *ptr, int memorder) \ u##bits __tsan_atomic##bits##_load(const u##bits *ptr, int memorder) \
{ \ { \
check_access(ptr, bits / BITS_PER_BYTE, KCSAN_ACCESS_ATOMIC); \ if (!IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS)) { \
check_access(ptr, bits / BITS_PER_BYTE, KCSAN_ACCESS_ATOMIC); \
} \
return __atomic_load_n(ptr, memorder); \ return __atomic_load_n(ptr, memorder); \
} \ } \
EXPORT_SYMBOL(__tsan_atomic##bits##_load); \ EXPORT_SYMBOL(__tsan_atomic##bits##_load); \
void __tsan_atomic##bits##_store(u##bits *ptr, u##bits v, int memorder); \ void __tsan_atomic##bits##_store(u##bits *ptr, u##bits v, int memorder); \
void __tsan_atomic##bits##_store(u##bits *ptr, u##bits v, int memorder) \ void __tsan_atomic##bits##_store(u##bits *ptr, u##bits v, int memorder) \
{ \ { \
check_access(ptr, bits / BITS_PER_BYTE, KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC); \ if (!IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS)) { \
check_access(ptr, bits / BITS_PER_BYTE, \
KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC); \
} \
__atomic_store_n(ptr, v, memorder); \ __atomic_store_n(ptr, v, memorder); \
} \ } \
EXPORT_SYMBOL(__tsan_atomic##bits##_store) EXPORT_SYMBOL(__tsan_atomic##bits##_store)
...@@ -930,8 +935,11 @@ EXPORT_SYMBOL(__tsan_init); ...@@ -930,8 +935,11 @@ EXPORT_SYMBOL(__tsan_init);
u##bits __tsan_atomic##bits##_##op(u##bits *ptr, u##bits v, int memorder); \ u##bits __tsan_atomic##bits##_##op(u##bits *ptr, u##bits v, int memorder); \
u##bits __tsan_atomic##bits##_##op(u##bits *ptr, u##bits v, int memorder) \ u##bits __tsan_atomic##bits##_##op(u##bits *ptr, u##bits v, int memorder) \
{ \ { \
check_access(ptr, bits / BITS_PER_BYTE, \ if (!IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS)) { \
KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC); \ check_access(ptr, bits / BITS_PER_BYTE, \
KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | \
KCSAN_ACCESS_ATOMIC); \
} \
return __atomic_##op##suffix(ptr, v, memorder); \ return __atomic_##op##suffix(ptr, v, memorder); \
} \ } \
EXPORT_SYMBOL(__tsan_atomic##bits##_##op) EXPORT_SYMBOL(__tsan_atomic##bits##_##op)
...@@ -959,8 +967,11 @@ EXPORT_SYMBOL(__tsan_init); ...@@ -959,8 +967,11 @@ EXPORT_SYMBOL(__tsan_init);
int __tsan_atomic##bits##_compare_exchange_##strength(u##bits *ptr, u##bits *exp, \ int __tsan_atomic##bits##_compare_exchange_##strength(u##bits *ptr, u##bits *exp, \
u##bits val, int mo, int fail_mo) \ u##bits val, int mo, int fail_mo) \
{ \ { \
check_access(ptr, bits / BITS_PER_BYTE, \ if (!IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS)) { \
KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC); \ check_access(ptr, bits / BITS_PER_BYTE, \
KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | \
KCSAN_ACCESS_ATOMIC); \
} \
return __atomic_compare_exchange_n(ptr, exp, val, weak, mo, fail_mo); \ return __atomic_compare_exchange_n(ptr, exp, val, weak, mo, fail_mo); \
} \ } \
EXPORT_SYMBOL(__tsan_atomic##bits##_compare_exchange_##strength) EXPORT_SYMBOL(__tsan_atomic##bits##_compare_exchange_##strength)
...@@ -971,8 +982,11 @@ EXPORT_SYMBOL(__tsan_init); ...@@ -971,8 +982,11 @@ EXPORT_SYMBOL(__tsan_init);
u##bits __tsan_atomic##bits##_compare_exchange_val(u##bits *ptr, u##bits exp, u##bits val, \ u##bits __tsan_atomic##bits##_compare_exchange_val(u##bits *ptr, u##bits exp, u##bits val, \
int mo, int fail_mo) \ int mo, int fail_mo) \
{ \ { \
check_access(ptr, bits / BITS_PER_BYTE, \ if (!IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS)) { \
KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC); \ check_access(ptr, bits / BITS_PER_BYTE, \
KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | \
KCSAN_ACCESS_ATOMIC); \
} \
__atomic_compare_exchange_n(ptr, &exp, val, 0, mo, fail_mo); \ __atomic_compare_exchange_n(ptr, &exp, val, 0, mo, fail_mo); \
return exp; \ return exp; \
} \ } \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment