The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Frederik Deweerdt <deweerdt@free.fr>
To: Eric Sesterhenn <snakebyte@gmx.de>
Cc: linux-kernel@vger.kernel.org, suresh.b.siddha@intel.com
Subject: Re: Oops with strace_test
Date: Mon, 5 May 2008 20:00:53 +0200	[thread overview]
Message-ID: <20080505180053.GB5576@slug> (raw)
In-Reply-To: <20080505100008.GA2354@alice>

On Mon, May 05, 2008 at 12:00:08PM +0200, Eric Sesterhenn wrote:
> * Eric Sesterhenn (snakebyte@gmx.de) wrote:
> > hi,
> > 
> > running the strace_test from ltp 20080229 (ltp.sf.net) gives me
> > two different oopses, so far i was not able to pinpoint to a specific
> > testcase (propably because the strace uses the rng to decided what fails
> > and what not) one oops is in iret_exc(), the other in __copy_from_user_ll()
> > The oopses dont happen with 2.6.24 so this appears to be a regression, i am starting
> > a git-bisect, but this might take some time
> > 
[...]
> 
> after some bisecting i found commit
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=aa283f49276e7d840a40fb01eee6de97eaa7e012;hp=61c4628b538608c1a85211ed8438136adfeb9a95
> to be guilty. After reverting this manually (didnt revert cleanly)
Hi Eric,

This appears to be caused by init_fpu() missing from the
restore_sigcontext->restore_i387->restore_fpu_checking code path.

I believe that moving the init_fpu() call from math_state_restore to
restore_fpu_checking should fix the problem?

Regards,
Frederik

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com>

diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 8069073..5b1af48 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -1142,22 +1142,6 @@ asmlinkage void math_state_restore(void)
 {
 	struct task_struct *me = current;
 
-	if (!used_math()) {
-		local_irq_enable();
-		/*
-		 * does a slab alloc which can sleep
-		 */
-		if (init_fpu(me)) {
-			/*
-			 * ran out of memory!
-			 */
-			do_group_exit(SIGKILL);
-			return;
-		}
-		local_irq_disable();
-	}
-
-	clts();			/* Allow maths ops (or we recurse) */
 	restore_fpu_checking(&me->thread.xstate->fxsave);
 	task_thread_info(me)->status |= TS_USEDFPU;
 	me->fpu_counter++;
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
index da2adb4..bf1cabe 100644
--- a/include/asm-x86/i387.h
+++ b/include/asm-x86/i387.h
@@ -47,7 +47,20 @@ static inline void tolerant_fwait(void)
 
 static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
 {
-	int err;
+	int err = -1;
+
+	if (!used_math()) {
+		local_irq_enable();
+		/*
+		 * does a slab alloc which can sleep
+		 */
+		if (init_fpu(current))
+			return err;
+		local_irq_disable();
+	}
+
+	clts();			/* Allow maths ops (or we recurse) */
 
 	asm volatile("1:  rex64/fxrstor (%[fx])\n\t"
 		     "2:\n"


  reply	other threads:[~2008-05-05 18:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 12:12 Oops with strace_test Eric Sesterhenn
2008-04-30 16:19 ` Andi Kleen
2008-05-05 10:00 ` Eric Sesterhenn
2008-05-05 18:00   ` Frederik Deweerdt [this message]
2008-05-06 12:10     ` Ingo Molnar
2008-05-06 15:07       ` Eric Sesterhenn
2008-05-07 10:36       ` Eric Sesterhenn
2008-05-07 13:36         ` Thomas Gleixner
2008-05-07 17:20           ` Eric Sesterhenn
2008-05-07 17:26             ` Thomas Gleixner
2008-05-07 19:09               ` Suresh Siddha
2008-05-07 21:46                 ` Eric Sesterhenn
2008-05-08 15:02                 ` Thomas Gleixner
2008-05-08 18:29                   ` Eric Sesterhenn

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=20080505180053.GB5576@slug \
    --to=deweerdt@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snakebyte@gmx.de \
    --cc=suresh.b.siddha@intel.com \
    /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