~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/kcsan.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * The Kernel Concurrency Sanitizer (KCSAN) infrastructure. Public interface and
  4  * data structures to set up runtime. See kcsan-checks.h for explicit checks and
  5  * modifiers. For more info please see Documentation/dev-tools/kcsan.rst.
  6  *
  7  * Copyright (C) 2019, Google LLC.
  8  */
  9 
 10 #ifndef _LINUX_KCSAN_H
 11 #define _LINUX_KCSAN_H
 12 
 13 #include <linux/kcsan-checks.h>
 14 #include <linux/types.h>
 15 
 16 #ifdef CONFIG_KCSAN
 17 
 18 /*
 19  * Context for each thread of execution: for tasks, this is stored in
 20  * task_struct, and interrupts access internal per-CPU storage.
 21  */
 22 struct kcsan_ctx {
 23         int disable_count; /* disable counter */
 24         int disable_scoped; /* disable scoped access counter */
 25         int atomic_next; /* number of following atomic ops */
 26 
 27         /*
 28          * We distinguish between: (a) nestable atomic regions that may contain
 29          * other nestable regions; and (b) flat atomic regions that do not keep
 30          * track of nesting. Both (a) and (b) are entirely independent of each
 31          * other, and a flat region may be started in a nestable region or
 32          * vice-versa.
 33          *
 34          * This is required because, for example, in the annotations for
 35          * seqlocks, we declare seqlock writer critical sections as (a) nestable
 36          * atomic regions, but reader critical sections as (b) flat atomic
 37          * regions, but have encountered cases where seqlock reader critical
 38          * sections are contained within writer critical sections (the opposite
 39          * may be possible, too).
 40          *
 41          * To support these cases, we independently track the depth of nesting
 42          * for (a), and whether the leaf level is flat for (b).
 43          */
 44         int atomic_nest_count;
 45         bool in_flat_atomic;
 46 
 47         /*
 48          * Access mask for all accesses if non-zero.
 49          */
 50         unsigned long access_mask;
 51 
 52         /* List of scoped accesses; likely to be empty. */
 53         struct list_head scoped_accesses;
 54 
 55 #ifdef CONFIG_KCSAN_WEAK_MEMORY
 56         /*
 57          * Scoped access for modeling access reordering to detect missing memory
 58          * barriers; only keep 1 to keep fast-path complexity manageable.
 59          */
 60         struct kcsan_scoped_access reorder_access;
 61 #endif
 62 };
 63 
 64 /**
 65  * kcsan_init - initialize KCSAN runtime
 66  */
 67 void kcsan_init(void);
 68 
 69 #else /* CONFIG_KCSAN */
 70 
 71 static inline void kcsan_init(void)                     { }
 72 
 73 #endif /* CONFIG_KCSAN */
 74 
 75 #endif /* _LINUX_KCSAN_H */
 76 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php