diff mbox series

[05/29] x86/fpu: add might_fault() to user_insn()

Message ID 20181128222035.2996-6-bigeasy@linutronix.de (mailing list archive)
State New, archived
Headers show
Series [01/29] x86/fpu: Use ULL for shift in xfeature_uncompacted_offset() | expand

Commit Message

Sebastian Andrzej Siewior Nov. 28, 2018, 10:20 p.m. UTC
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.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/include/asm/fpu/internal.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Rik van Riel Nov. 29, 2018, 1:54 a.m. UTC | #1
On Wed, 2018-11-28 at 23:20 +0100, Sebastian Andrzej Siewior wrote:
> 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.

Nice catch.

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Reviewed-by: Rik van Riel <riel@surriel.com>
diff mbox series

Patch

diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
index 69dcdf195b611..978a1633c0698 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -106,6 +106,7 @@  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"				\