summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/thread_info.h
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2022-11-18 20:23:05 +0300
committerDave Hansen <dave.hansen@linux.intel.com>2023-01-27 20:00:56 +0300
commitce3ba2af9695e4bd64d797e0026321e5dca29dd3 (patch)
tree180cf61bade5ba55aa18ebd5b14f517ab6bae84c /arch/x86/include/asm/thread_info.h
parent6be9a8f18fb2ea88d37a69f076f7011fc012ae1a (diff)
downloadlinux-ce3ba2af9695e4bd64d797e0026321e5dca29dd3.tar.xz
x86: Suppress KMSAN reports in arch_within_stack_frames()
arch_within_stack_frames() performs stack walking and may confuse KMSAN by stepping on stale shadow values. To prevent false positive reports, disable KMSAN checks in this function. This fixes KMSAN's interoperability with CONFIG_HARDENED_USERCOPY. Signed-off-by: Alexander Potapenko <glider@google.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Tested-by: Eric Biggers <ebiggers@google.com> Link: https://github.com/google/kmsan/issues/89 Link: https://lore.kernel.org/lkml/Y3b9AAEKp2Vr3e6O@sol.localdomain/ Link: https://lore.kernel.org/all/20221118172305.3321253-1-glider%40google.com
Diffstat (limited to 'arch/x86/include/asm/thread_info.h')
-rw-r--r--arch/x86/include/asm/thread_info.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index f0cb881c1d69..f1cccba52eb9 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -163,7 +163,12 @@ struct thread_info {
* GOOD_FRAME if within a frame
* BAD_STACK if placed across a frame boundary (or outside stack)
* NOT_STACK unable to determine (no frame pointers, etc)
+ *
+ * This function reads pointers from the stack and dereferences them. The
+ * pointers may not have their KMSAN shadow set up properly, which may result
+ * in false positive reports. Disable instrumentation to avoid those.
*/
+__no_kmsan_checks
static inline int arch_within_stack_frames(const void * const stack,
const void * const stackend,
const void *obj, unsigned long len)