aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/xsave.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2008-08-13 14:38:14 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-14 04:56:06 -0400
commited405958057ca6a8c4c9178a7a3b1167fabb45f5 (patch)
tree7255d950f6c1b7c58bd96307b9aaa871c2eba9f4 /arch/x86/kernel/xsave.c
parentee2b92a8201a40021ecd1aee6f0625dc03bacc54 (diff)
x86, xsave: clear the user buffer before doing fxsave/xsave
fxsave/xsave instructions will not touch all the bytes in the fxsave/xsave frame. Clear the user buffer before doing fxsave/xsave directly to user buffer during the sigcontext setup. This is essentially needed in the context of xsave(for example, some of the fields in the xsave header are not touched by the xsave and defined as must be zero). This will also present uniform and clean context to the user (from which user can safely do fxrstor/xrstor). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/xsave.c')
-rw-r--r--arch/x86/kernel/xsave.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 7415f3e38a51..bb097b1644d8 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -92,6 +92,12 @@ int save_i387_xstate(void __user *buf)
92 return 0; 92 return 0;
93 clear_used_math(); /* trigger finit */ 93 clear_used_math(); /* trigger finit */
94 if (task_thread_info(tsk)->status & TS_USEDFPU) { 94 if (task_thread_info(tsk)->status & TS_USEDFPU) {
95 /*
96 * Start with clearing the user buffer. This will present a
97 * clean context for the bytes not touched by the fxsave/xsave.
98 */
99 __clear_user(buf, sig_xstate_size);
100
95 if (task_thread_info(tsk)->status & TS_XSAVE) 101 if (task_thread_info(tsk)->status & TS_XSAVE)
96 err = xsave_user(buf); 102 err = xsave_user(buf);
97 else 103 else