Re: [5.2 regression] copy_fpstate_to_sigframe() change causing crash in 32-bit process

From: Eric Biggers
Date: Wed Jun 05 2019 - 13:37:03 EST

On Wed, Jun 05, 2019 at 04:04:05PM +0200, Sebastian Andrzej Siewior wrote:
> On 2019-06-04 11:53:58 [-0700], Eric Biggers wrote:
> > On latest Linus' tree I'm getting a crash in a 32-bit Wine process.
> >
> > I bisected it to the following commit:
> >
> > commit 39388e80f9b0c3788bfb6efe3054bdce0c3ead45
> > Author: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> > Date: Wed Apr 3 18:41:35 2019 +0200
> >
> > x86/fpu: Don't save fxregs for ia32 frames in copy_fpstate_to_sigframe()
> >
> > Reverting the commit by applying the following diff makes the problem go away.
> This looked like a merge artifact and it has been confirmed as such. Now
> you say that this was a needed piece of code. Interesting.
> Is that wine process/testcase something you can share? I will try to
> take a closer look.
> Sebastian

As I said, the commit looks broken to me. save_fsave_header() reads from
tsk->thread.fpu.state.fxsave, which due to that commit isn't being updated with
the latest registers. Am I missing something? Note the comment you deleted:

/* Update the thread's fxstate to save the fsave header. */

My test case was "run some Win32 game for a few minutes and see if it crashes"
so it's not really sharable, sorry. But I expect it would be possible to write
a minimal test case, where a 32-bit process sends a signal to itself and checks
whether the i387 floating point stuff gets restored correctly afterwards.

- Eric