mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: mingo@elte.hu, tglx@linutronix.de
Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH x86/mm] x86: i387 fpregs_set convert_to_fxsr
Date: Thu, 24 Jan 2008 17:59:33 -0800 (PST)	[thread overview]
Message-ID: <20080125015933.587DF26F9FD@magilla.localdomain> (raw)
In-Reply-To: Siddha, Suresh B's message of  Thursday, 24 January 2008 17:40:59 -0800 <20080125014059.GA5342@linux-os.sc.intel.com>

Thanks for catching that, Suresh.  
The fix needed a few nits different from your patch.


Thanks,
Roland

---

This fixes the bug introduced recently during the revamp of the code.
fpregs_set() needs to use convert_to_fxsr() rather than copying into the
fxsave struct directly.

Reported-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/x86/kernel/i387.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 7e354a3..26719bd 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -326,6 +326,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
 	       unsigned int pos, unsigned int count,
 	       const void *kbuf, const void __user *ubuf)
 {
+	struct user_i387_ia32_struct env;
 	int ret;
 
 	if (!HAVE_HWFP)
@@ -338,13 +339,12 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
 		return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 					  &target->thread.i387.fsave, 0, -1);
 
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &target->thread.i387.fxsave, 0, -1);
+	if (pos > 0 || count < sizeof(env))
+		convert_from_fxsr(&env, target);
 
-	/*
-	 * mxcsr reserved bits must be masked to zero for security reasons.
-	 */
-	target->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask;
+	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &env, 0, -1);
+	if (!ret)
+		convert_to_fxsr(target, &env);
 
 	return ret;
 }

  reply	other threads:[~2008-01-25  1:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-25  1:40 [patch] x86, i387: use convert_to_fxsr() in fpregs_set() Siddha, Suresh B
2008-01-25  1:59 ` Roland McGrath [this message]
2008-01-25 18:04   ` [PATCH x86/mm] x86: i387 fpregs_set convert_to_fxsr Siddha, Suresh B
2008-01-25 20:38     ` Roland McGrath
2008-01-25 10:49 ` [patch] x86, i387: use convert_to_fxsr() in fpregs_set() 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=20080125015933.587DF26F9FD@magilla.localdomain \
    --to=roland@redhat.com \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --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

all inboxes | Powered by JetHome®