public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Oleg Nesterov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	sbsiddha@gmail.com, oleg@redhat.com, tglx@linutronix.de,
	hpa@linux.intel.com
Subject: [tip:x86/fpu] x86, fpu: __restore_xstate_sig()-> math_state_restore() needs preempt_disable()
Date: Tue, 2 Sep 2014 15:18:47 -0700	[thread overview]
Message-ID: <tip-df24fb859a4e200d9324e2974229fbb7adf00aef@git.kernel.org> (raw)
In-Reply-To: <20140902175717.GA21649@redhat.com>

Commit-ID:  df24fb859a4e200d9324e2974229fbb7adf00aef
Gitweb:     http://git.kernel.org/tip/df24fb859a4e200d9324e2974229fbb7adf00aef
Author:     Oleg Nesterov <oleg@redhat.com>
AuthorDate: Tue, 2 Sep 2014 19:57:17 +0200
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Tue, 2 Sep 2014 14:51:15 -0700

x86, fpu: __restore_xstate_sig()->math_state_restore() needs preempt_disable()

Add preempt_disable() + preempt_enable() around math_state_restore() in
__restore_xstate_sig(). Otherwise __switch_to() after __thread_fpu_begin()
can overwrite fpu->state we are going to restore.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/20140902175717.GA21649@redhat.com
Cc: <stable@vger.kernel.org> # v3.7+
Reviewed-by: Suresh Siddha <sbsiddha@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/xsave.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index cf0b830..4c540c4 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -400,8 +400,11 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
 			set_used_math();
 		}
 
-		if (use_eager_fpu())
+		if (use_eager_fpu()) {
+			preempt_disable();
 			math_state_restore();
+			preempt_enable();
+		}
 
 		return err;
 	} else {

  reply	other threads:[~2014-09-02 22:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 17:56 [PATCH 0/7] x86, fpu: misc fixes/cleanups, more to come Oleg Nesterov
2014-09-02 17:57 ` [PATCH v2 1/7] x86, fpu: shift drop_init_fpu() from save_xstate_sig() to handle_signal() Oleg Nesterov
2014-09-02 22:18   ` [tip:x86/fpu] " tip-bot for Oleg Nesterov
2014-09-02 17:57 ` [PATCH v2 2/7] x86, fpu: __restore_xstate_sig()->math_state_restore() needs preempt_disable() Oleg Nesterov
2014-09-02 22:18   ` tip-bot for Oleg Nesterov [this message]
2014-09-02 17:57 ` [PATCH v2 3/7] x86, fpu: change __thread_fpu_begin() to use use_eager_fpu() Oleg Nesterov
2014-09-02 22:19   ` [tip:x86/fpu] x86, fpu: Change " tip-bot for Oleg Nesterov
2014-09-02 17:57 ` [PATCH v2 4/7] x86, fpu: copy_process: avoid fpu_alloc/copy if !used_math() Oleg Nesterov
2014-09-02 22:19   ` [tip:x86/fpu] x86, fpu: copy_process: Avoid fpu_alloc/ copy " tip-bot for Oleg Nesterov
2014-09-02 17:57 ` [PATCH v2 5/7] x86, fpu: copy_process: sanitize fpu->last_cpu initialization Oleg Nesterov
2014-09-02 22:19   ` [tip:x86/fpu] x86, fpu: copy_process: Sanitize fpu-> last_cpu initialization tip-bot for Oleg Nesterov
2014-09-02 17:57 ` [PATCH v2 6/7] x86, fpu: shift "fpu_counter = 0" from copy_thread() to arch_dup_task_struct() Oleg Nesterov
2014-09-02 22:19   ` [tip:x86/fpu] x86, fpu: Shift "fpu_counter = 0" from copy_thread( ) " tip-bot for Oleg Nesterov
2014-09-02 17:57 ` [PATCH v2 7/7] x86: copy_thread: don't nullify ->ptrace_bps twice Oleg Nesterov
2014-09-02 22:19   ` [tip:x86/fpu] x86: copy_thread: Don't " tip-bot for Oleg Nesterov

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=tip-df24fb859a4e200d9324e2974229fbb7adf00aef@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=sbsiddha@gmail.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