All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gareth Hughes <gareth@valinux.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	dledford@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: SETFPXREGS fix
Date: Sat, 04 Nov 2000 12:13:33 +1100	[thread overview]
Message-ID: <3A0362BD.D6068EDE@valinux.com> (raw)
In-Reply-To: <20001103174105.C857@athlon.random> <3A034F28.5DB994F4@valinux.com> <20001104020709.D32767@athlon.random>

Andrea Arcangeli wrote:
> 
> On Sat, Nov 04, 2000 at 10:50:00AM +1100, Gareth Hughes wrote:
> >       if ( HAVE_FXSR ) {
> >               if ( __copy_from_user( &tsk->thread.i387.fxsave, (void *)buf,
> >                                       sizeof(struct user_fxsr_struct) ) )
> >                       return -EFAULT;
> >               /* bit 6 and 31-16 must be zero for security reasons */
> >               tsk->thread.i387.fxsave.mxcsr &= 0x0000ffbf;
> >               return 0;
> >       }
> 
> The above doesn't fix the security problem. Put the last byte of the userspace
> structure on an unmapped page and it will return -EFAULT lefting the invalid
> mxcsr value that will corrupt the FPU again.
> 
> The right version of the above is just in linux mailbox.
> 
> The reason I did it more complex at first is because I wanted to go safe,
> I wasn't sure if somebody could SIGCONT the traced task while we was copying
> the data so introducing a race where it was still possible to exploit
> the bug; but as Linus pointed out to me the loop in do_signal prevents that, so
> we can do only one large copy and then fixup (fixing up also in the -EFAULT
> case of course).

Yes, we can certainly mask out the mxcsr value in both cases.  I just
think this makes the code a lot simpler and cleaner as a result - three
partial copies seems over the top.

-- Gareth
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-11-04  1:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-03 16:41 SETFPXREGS fix Andrea Arcangeli
2000-11-03 23:50 ` Gareth Hughes
2000-11-04  1:07   ` Andrea Arcangeli
2000-11-04  1:13     ` Gareth Hughes [this message]
2000-11-04  1:29       ` Andrea Arcangeli

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=3A0362BD.D6068EDE@valinux.com \
    --to=gareth@valinux.com \
    --cc=andrea@suse.de \
    --cc=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.