[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080724230242.GO14380@linux-os.sc.intel.com>
Date: Thu, 24 Jul 2008 16:02:43 -0700
From: Suresh Siddha <suresh.b.siddha@...el.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "Siddha, Suresh B" <suresh.b.siddha@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"andi@...stfloor.org" <andi@...stfloor.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"stable@...nel.org" <stable@...nel.org>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [patch] x64, fpu: fix possible FPU leakage in error conditions
On Thu, Jul 24, 2008 at 03:43:44PM -0700, Linus Torvalds wrote:
>
>
> On Thu, 24 Jul 2008, Suresh Siddha wrote:
> > >
> > > but the thing is, the only really valid reason for "restore_i387()" to
> > > fail is because the read failed.
> >
> > Not really. It can cause #GP, if someone sets reserved bits of mxcsr
> > in the memory image.
>
> Ahh, ok, I can imagine that. And I guess we might copy the data from user
> space into the memory image without validating it at points (signal
> handler restore and/or ptrace). Do we?
Today in ptrace (and in 32bit signal handling), we copy the user data and
then clear the reserved bits blindly again ;)
In 64bit signal handling, we do a fxrstor from the live user buffer and
scream then itself if we find an issue.
Andi being paranoid, added more checks for 64bit math_state_restore().
> > But restore_i387() may be in an insane state (we did clts() but doesn't
> > have the proper state in its live registers etc) when it failed to restore fpu.
> > Ideally we should fix this inside restore_i387(). But restore_i387()
> > is in header file and I have to re-arrange some of the code
> > in the header file, to call clear_fpu() from restore_i387().
>
> Ok, how about we just move restore_i387() out of the header file? I
> realize that the x86 code plays some games with this whole thing (that
> whole '#define restore_i387_ia32 restore_i387'), but that is 32-bit
> specific, and the restore_i387() in the header file is 64-bit specific.
>
> Hmm. In fact, I think that x86-64 version is actually only used in a
> single place - arch/x86/kernel/signal_64.c. So it's actively *wrong* to
> have that thing in a header file to begin with!
>
> So how about this patch as a starting point? This is the RightThing(tm) to
> do regardless, and if it then makes it easier to do some other cleanups,
> we should do it first. What do you think?
Sure. You have my Ack. I will request -stable folks to pickup multiple patches
(second patch, I will post shortly on top of yours).
thanks,
suresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists