Skip to content

Commit 11385b2

Browse files
ramosian-gliderakpm00
authored andcommitted
x86/uaccess: instrument copy_from_user_nmi()
Make sure usercopy hooks from linux/instrumented.h are invoked for copy_from_user_nmi(). This fixes KMSAN false positives reported when dumping opcodes for a stack trace. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Alexander Potapenko <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Kees Cook <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Marco Elver <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent cbadaf7 commit 11385b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/x86/lib/usercopy.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <linux/uaccess.h>
88
#include <linux/export.h>
9+
#include <linux/instrumented.h>
910

1011
#include <asm/tlbflush.h>
1112

@@ -44,7 +45,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
4445
* called from other contexts.
4546
*/
4647
pagefault_disable();
48+
instrument_copy_from_user_before(to, from, n);
4749
ret = raw_copy_from_user(to, from, n);
50+
instrument_copy_from_user_after(to, from, n, ret);
4851
pagefault_enable();
4952

5053
return ret;

0 commit comments

Comments
 (0)