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

Showing the changes to include/linux (2 of 2 files). Show all

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
3232 */
3333 void __kcsan_check_access(const volatile void *ptr, size_t size, int type);
3434
35−#else
35+/**
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+ */
41+void kcsan_nestable_atomic_begin(void);
42+
43+/**
44+ * kcsan_nestable_atomic_end - end nestable atomic region
45+ */
46+void 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+ */
54+void kcsan_flat_atomic_begin(void);
55+
56+/**
57+ * kcsan_flat_atomic_end - end flat atomic region
58+ */
59+void 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+ */
69+void kcsan_atomic_next(int n);
70+
71+#else /* CONFIG_KCSAN */
72+
3673 static inline void __kcsan_check_access(const volatile void *ptr, size_t size,
3774 int type) { }
38−#endif
75+
76+static inline void kcsan_nestable_atomic_begin(void) { }
77+static inline void kcsan_nestable_atomic_end(void) { }
78+static inline void kcsan_flat_atomic_begin(void) { }
79+static inline void kcsan_flat_atomic_end(void) { }
80+static inline void kcsan_atomic_next(int n) { }
81+
82+#endif /* CONFIG_KCSAN */
3983
4084 /*
4185 * 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
5656 */
5757 void kcsan_enable_current(void);
5858
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− */
65−void kcsan_nestable_atomic_begin(void);
66−
67−/**
68− * kcsan_nestable_atomic_end - end nestable atomic region
69− */
70−void 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− */
78−void kcsan_flat_atomic_begin(void);
79−
80−/**
81− * kcsan_flat_atomic_end - end flat atomic region
82− */
83−void 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− */
93−void kcsan_atomic_next(int n);
94−
9559 #else /* CONFIG_KCSAN */
9660
9761 static inline void kcsan_init(void) { }
9862 static inline void kcsan_disable_current(void) { }
9963 static inline void kcsan_enable_current(void) { }
100−static inline void kcsan_nestable_atomic_begin(void) { }
101−static inline void kcsan_nestable_atomic_end(void) { }
102−static inline void kcsan_flat_atomic_begin(void) { }
103−static inline void kcsan_flat_atomic_end(void) { }
104−static inline void kcsan_atomic_next(int n) { }
10564
10665 #endif /* CONFIG_KCSAN */
10766