Skip to content

Commit ce3ba2a

Browse files
ramosian-gliderhansendc
authored andcommitted
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 <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Tested-by: Eric Biggers <[email protected]> Link: google/kmsan#89 Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lore.kernel.org/all/20221118172305.3321253-1-glider%40google.com
1 parent 6be9a8f commit ce3ba2a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/include/asm/thread_info.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@ struct thread_info {
163163
* GOOD_FRAME if within a frame
164164
* BAD_STACK if placed across a frame boundary (or outside stack)
165165
* NOT_STACK unable to determine (no frame pointers, etc)
166+
*
167+
* This function reads pointers from the stack and dereferences them. The
168+
* pointers may not have their KMSAN shadow set up properly, which may result
169+
* in false positive reports. Disable instrumentation to avoid those.
166170
*/
171+
__no_kmsan_checks
167172
static inline int arch_within_stack_frames(const void * const stack,
168173
const void * const stackend,
169174
const void *obj, unsigned long len)

0 commit comments

Comments
 (0)