From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 13 May 2024 17:13:39 +0000 (-0700)
Subject: Merge tag 'kcsan.2024.05.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmc... 
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c07ea940a011343fdaec12cd74b4ff947ba6f893;p=users%2Fhch%2Fblock.git

Merge tag 'kcsan.2024.05.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu

Pull kcsan update from Paul McKenney:
 "Introduce __data_racy type qualifier

  This adds a __data_racy type qualifier that enables kernel developers
  to inform KCSAN that a given variable is a shared variable without
  needing to mark each and every access.

  This allows pre-KCSAN code to be correctly (if approximately)
  instrumented withh very little effort, and also provides people
  reading the code a clear indication that the variable is in fact
  shared.

  In addition, it permits incremental transition to per-access KCSAN
  marking, so that (for example) a given subsystem can be transitioned
  one variable at a time, while avoiding large numbers of KCSAN warnings
  during this transition"

* tag 'kcsan.2024.05.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
  kcsan, compiler_types: Introduce __data_racy type qualifier
---

c07ea940a011343fdaec12cd74b4ff947ba6f893
diff --cc include/linux/compiler_types.h
index 8f8236317d5b,a38162a8590d..774c2570fe51
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@@ -276,19 -282,9 +282,20 @@@ struct ftrace_likely_data 
  # define __no_sanitize_or_inline __no_kcsan notrace __maybe_unused
  #else
  # define __no_kcsan
+ # define __data_racy
  #endif
  
 +#ifdef __SANITIZE_MEMORY__
 +/*
 + * Similarly to KASAN and KCSAN, KMSAN loses function attributes of inlined
 + * functions, therefore disabling KMSAN checks also requires disabling inlining.
 + *
 + * __no_sanitize_or_inline effectively prevents KMSAN from reporting errors
 + * within the function and marks all its outputs as initialized.
 + */
 +# define __no_sanitize_or_inline __no_kmsan_checks notrace __maybe_unused
 +#endif
 +
  #ifndef __no_sanitize_or_inline
  #define __no_sanitize_or_inline __always_inline
  #endif