2019-11-15 02:02:54 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
|
|
|
|
#ifndef _KERNEL_KCSAN_ATOMIC_H
|
|
|
|
#define _KERNEL_KCSAN_ATOMIC_H
|
|
|
|
|
|
|
|
#include <linux/jiffies.h>
|
2020-02-25 22:32:58 +08:00
|
|
|
#include <linux/sched.h>
|
2019-11-15 02:02:54 +08:00
|
|
|
|
|
|
|
/*
|
2020-02-25 22:32:58 +08:00
|
|
|
* Special rules for certain memory where concurrent conflicting accesses are
|
|
|
|
* common, however, the current convention is to not mark them; returns true if
|
|
|
|
* access to @ptr should be considered atomic. Called from slow-path.
|
2019-11-15 02:02:54 +08:00
|
|
|
*/
|
2020-02-25 22:32:58 +08:00
|
|
|
static bool kcsan_is_atomic_special(const volatile void *ptr)
|
2019-11-15 02:02:54 +08:00
|
|
|
{
|
2020-02-25 22:32:58 +08:00
|
|
|
/* volatile globals that have been observed in data races. */
|
|
|
|
return ptr == &jiffies || ptr == ¤t->state;
|
2019-11-15 02:02:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _KERNEL_KCSAN_ATOMIC_H */
|