diff options
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/i387.h | 9 | ||||
-rw-r--r-- | arch/x86/include/asm/xsave.h | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h index 815c5b2b9f57..f1accc625beb 100644 --- a/arch/x86/include/asm/i387.h +++ b/arch/x86/include/asm/i387.h | |||
@@ -127,6 +127,15 @@ static inline int fxsave_user(struct i387_fxsave_struct __user *fx) | |||
127 | { | 127 | { |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | /* | ||
131 | * Clear the bytes not touched by the fxsave and reserved | ||
132 | * for the SW usage. | ||
133 | */ | ||
134 | err = __clear_user(&fx->sw_reserved, | ||
135 | sizeof(struct _fpx_sw_bytes)); | ||
136 | if (unlikely(err)) | ||
137 | return -EFAULT; | ||
138 | |||
130 | asm volatile("1: rex64/fxsave (%[fx])\n\t" | 139 | asm volatile("1: rex64/fxsave (%[fx])\n\t" |
131 | "2:\n" | 140 | "2:\n" |
132 | ".section .fixup,\"ax\"\n" | 141 | ".section .fixup,\"ax\"\n" |
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 32c36668fa7b..06acdbd7570a 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h | |||
@@ -65,6 +65,16 @@ static inline int fpu_xrstor_checking(struct fpu *fpu) | |||
65 | static inline int xsave_user(struct xsave_struct __user *buf) | 65 | static inline int xsave_user(struct xsave_struct __user *buf) |
66 | { | 66 | { |
67 | int err; | 67 | int err; |
68 | |||
69 | /* | ||
70 | * Clear the xsave header first, so that reserved fields are | ||
71 | * initialized to zero. | ||
72 | */ | ||
73 | err = __clear_user(&buf->xsave_hdr, | ||
74 | sizeof(struct xsave_hdr_struct)); | ||
75 | if (unlikely(err)) | ||
76 | return -EFAULT; | ||
77 | |||
68 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" | 78 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" |
69 | "2:\n" | 79 | "2:\n" |
70 | ".section .fixup,\"ax\"\n" | 80 | ".section .fixup,\"ax\"\n" |