4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

[ Upstream commit 6637401c35b2f327a35d27f44bda05e327f2f017 ]

Every user of user_insn() passes an user memory pointer to this macro.

Add might_fault() to user_insn() so we can spot users which are using
this macro in sections where page faulting is not allowed.

 [ bp: Space it out to make it more visible. ]

Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
Signed-off-by: Borislav Petkov <b...@suse.de>
Reviewed-by: Rik van Riel <r...@surriel.com>
Cc: "H. Peter Anvin" <h...@zytor.com>
Cc: "Jason A. Donenfeld" <ja...@zx2c4.com>
Cc: Andy Lutomirski <l...@kernel.org>
Cc: Dave Hansen <dave.han...@linux.intel.com>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: Jann Horn <ja...@google.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: Radim Krčmář <rkrc...@redhat.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: kvm ML <k...@vger.kernel.org>
Cc: x86-ml <x...@kernel.org>
Link: https://lkml.kernel.org/r/20181128222035.2996-6-bige...@linutronix.de
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 arch/x86/include/asm/fpu/internal.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/fpu/internal.h 
b/arch/x86/include/asm/fpu/internal.h
index 69dcdf195b61..fa2c93cb42a2 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -106,6 +106,9 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu);
 #define user_insn(insn, output, input...)                              \
 ({                                                                     \
        int err;                                                        \
+                                                                       \
+       might_fault();                                                  \
+                                                                       \
        asm volatile(ASM_STAC "\n"                                      \
                     "1:" #insn "\n\t"                                  \
                     "2: " ASM_CLAC "\n"                                \
-- 
2.19.1



Reply via email to