From: Suresh Siddha <suresh.b.siddha@intel.com>
To: mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, Suresh Siddha <suresh.b.siddha@intel.com>
Subject: [patch 2/3] x86, xsave: clear the user buffer before doing fxsave/xsave
Date: Wed, 13 Aug 2008 11:38:14 -0700 [thread overview]
Message-ID: <20080813183857.107206000@linux-os.sc.intel.com> (raw)
In-Reply-To: 20080813183856.964126000@linux-os.sc.intel.com
[-- Attachment #1: init_fpstate_user_buf.patch --]
[-- Type: text/plain, Size: 1164 bytes --]
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>
---
Index: tip/arch/x86/kernel/xsave.c
===================================================================
--- tip.orig/arch/x86/kernel/xsave.c 2008-08-11 15:26:47.000000000 -0700
+++ tip/arch/x86/kernel/xsave.c 2008-08-11 15:44:33.000000000 -0700
@@ -92,6 +92,12 @@
return 0;
clear_used_math(); /* trigger finit */
if (task_thread_info(tsk)->status & TS_USEDFPU) {
+ /*
+ * Start with clearing the user buffer. This will present a
+ * clean context for the bytes not touched by the fxsave/xsave.
+ */
+ __clear_user(buf, sig_xstate_size);
+
if (task_thread_info(tsk)->status & TS_XSAVE)
err = xsave_user(buf);
else
--
next prev parent reply other threads:[~2008-08-13 18:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 18:38 [patch 1/3] x86, xsave: remove the redundant access_ok() in setup_rt_frame() Suresh Siddha
2008-08-13 18:38 ` Suresh Siddha [this message]
2008-08-13 18:38 ` [patch 3/3] x86, xsave: use BUG_ON() instead of BUILD_BUG_ON() Suresh Siddha
2008-08-14 8:56 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080813183857.107206000@linux-os.sc.intel.com \
--to=suresh.b.siddha@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox