History

kcsan: Move interfaces that affects checks to kcsan-checks.h

This moves functions that affect state changing the behaviour of kcsan_check_access() to kcsan-checks.h. Since these are likely used with kcsan_check_access() it makes more sense to have them in kcsan-checks.h, to avoid including all of 'include/linux/kcsan.h'. No functional change intended.

Marco Elver committed 6 years ago

Commit f0f69281 parent 3a5b45e2 files · +46 −43Browse files

Unified · Split

2 files
  1. include/linux/kcsan-checks.h +46 −2
  2. include/linux/kcsan.h +0 −41
include/linux/kcsan-checks.h+46−2
@@ -32,10 +32,54 @@ · 31 unmodified lines
32 */32 */
33void __kcsan_check_access(const volatile void *ptr, size_t size, int type);33void __kcsan_check_access(const volatile void *ptr, size_t size, int type);
34 34
35#else35/**
36 * kcsan_nestable_atomic_begin - begin nestable atomic region
37 *
38 * Accesses within the atomic region may appear to race with other accesses but
39 * should be considered atomic.
40 */
41void kcsan_nestable_atomic_begin(void);
42
43/**
44 * kcsan_nestable_atomic_end - end nestable atomic region
45 */
46void kcsan_nestable_atomic_end(void);
47
48/**
49 * kcsan_flat_atomic_begin - begin flat atomic region
50 *
51 * Accesses within the atomic region may appear to race with other accesses but
52 * should be considered atomic.
53 */
54void kcsan_flat_atomic_begin(void);
55
56/**
57 * kcsan_flat_atomic_end - end flat atomic region
58 */
59void kcsan_flat_atomic_end(void);
60
61/**
62 * kcsan_atomic_next - consider following accesses as atomic
63 *
64 * Force treating the next n memory accesses for the current context as atomic
65 * operations.
66 *
67 * @n number of following memory accesses to treat as atomic.
68 */
69void kcsan_atomic_next(int n);
70
71#else /* CONFIG_KCSAN */
72
36static inline void __kcsan_check_access(const volatile void *ptr, size_t size,73static inline void __kcsan_check_access(const volatile void *ptr, size_t size,
37 int type) { }74 int type) { }
38#endif75
76static inline void kcsan_nestable_atomic_begin(void) { }
77static inline void kcsan_nestable_atomic_end(void) { }
78static inline void kcsan_flat_atomic_begin(void) { }
79static inline void kcsan_flat_atomic_end(void) { }
80static inline void kcsan_atomic_next(int n) { }
81
82#endif /* CONFIG_KCSAN */
39 83
40/*84/*
41 * kcsan_*: Only calls into the runtime when the particular compilation unit has85 * kcsan_*: Only calls into the runtime when the particular compilation unit has
include/linux/kcsan.h+0−41
@@ -56,52 +56,11 @@ void kcsan_disable_current(void); · 55 unmodified lines
56 */56 */
57void kcsan_enable_current(void);57void kcsan_enable_current(void);
58 58
59/**
60 * kcsan_nestable_atomic_begin - begin nestable atomic region
61 *
62 * Accesses within the atomic region may appear to race with other accesses but
63 * should be considered atomic.
64 */
65void kcsan_nestable_atomic_begin(void);
66
67/**
68 * kcsan_nestable_atomic_end - end nestable atomic region
69 */
70void kcsan_nestable_atomic_end(void);
71
72/**
73 * kcsan_flat_atomic_begin - begin flat atomic region
74 *
75 * Accesses within the atomic region may appear to race with other accesses but
76 * should be considered atomic.
77 */
78void kcsan_flat_atomic_begin(void);
79
80/**
81 * kcsan_flat_atomic_end - end flat atomic region
82 */
83void kcsan_flat_atomic_end(void);
84
85/**
86 * kcsan_atomic_next - consider following accesses as atomic
87 *
88 * Force treating the next n memory accesses for the current context as atomic
89 * operations.
90 *
91 * @n number of following memory accesses to treat as atomic.
92 */
93void kcsan_atomic_next(int n);
94
95#else /* CONFIG_KCSAN */59#else /* CONFIG_KCSAN */
96 60
97static inline void kcsan_init(void) { }61static inline void kcsan_init(void) { }
98static inline void kcsan_disable_current(void) { }62static inline void kcsan_disable_current(void) { }
99static inline void kcsan_enable_current(void) { }63static inline void kcsan_enable_current(void) { }
100static inline void kcsan_nestable_atomic_begin(void) { }
101static inline void kcsan_nestable_atomic_end(void) { }
102static inline void kcsan_flat_atomic_begin(void) { }
103static inline void kcsan_flat_atomic_end(void) { }
104static inline void kcsan_atomic_next(int n) { }
105 64
106#endif /* CONFIG_KCSAN */65#endif /* CONFIG_KCSAN */
107 66