Skip to content

Commit

Permalink
kcsan: Move kcsan_{disable,enable}_current() to kcsan-checks.h
Browse files Browse the repository at this point in the history
Both affect access checks, and should therefore be in kcsan-checks.h.
This is in preparation to use these in compiler.h.

Acked-by: Will Deacon <[email protected]>
Signed-off-by: Marco Elver <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
  • Loading branch information
melver authored and paulmckrcu committed Apr 14, 2020
1 parent d8949ef commit 01b4ff5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 16 additions & 0 deletions include/linux/kcsan-checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
*/
void __kcsan_check_access(const volatile void *ptr, size_t size, int type);

/**
* kcsan_disable_current - disable KCSAN for the current context
*
* Supports nesting.
*/
void kcsan_disable_current(void);

/**
* kcsan_enable_current - re-enable KCSAN for the current context
*
* Supports nesting.
*/
void kcsan_enable_current(void);

/**
* kcsan_nestable_atomic_begin - begin nestable atomic region
*
Expand Down Expand Up @@ -133,6 +147,8 @@ void kcsan_end_scoped_access(struct kcsan_scoped_access *sa);
static inline void __kcsan_check_access(const volatile void *ptr, size_t size,
int type) { }

static inline void kcsan_disable_current(void) { }
static inline void kcsan_enable_current(void) { }
static inline void kcsan_nestable_atomic_begin(void) { }
static inline void kcsan_nestable_atomic_end(void) { }
static inline void kcsan_flat_atomic_begin(void) { }
Expand Down
16 changes: 0 additions & 16 deletions include/linux/kcsan.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,9 @@ struct kcsan_ctx {
*/
void kcsan_init(void);

/**
* kcsan_disable_current - disable KCSAN for the current context
*
* Supports nesting.
*/
void kcsan_disable_current(void);

/**
* kcsan_enable_current - re-enable KCSAN for the current context
*
* Supports nesting.
*/
void kcsan_enable_current(void);

#else /* CONFIG_KCSAN */

static inline void kcsan_init(void) { }
static inline void kcsan_disable_current(void) { }
static inline void kcsan_enable_current(void) { }

#endif /* CONFIG_KCSAN */

Expand Down

0 comments on commit 01b4ff5

Please sign in to comment.