Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1391510
| From | Yu-cheng Yu <yu-cheng.yu@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly |
| Date | 2016-04-30 00:50 +0200 |
| Message-ID | <rtpou-5CD-15@gated-at.bofh.it> (permalink) |
| References | <r92ut-2hO-1@gated-at.bofh.it> <r92uu-2hO-5@gated-at.bofh.it> <rtmTD-3yl-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Apr 29, 2016 at 01:09:07PM -0700, Dave Hansen wrote:
> On 03/04/2016 10:12 AM, Yu-cheng Yu wrote:
> > diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
> > index 0fbf60c..09945f1 100644
> > --- a/arch/x86/kernel/fpu/signal.c
> > +++ b/arch/x86/kernel/fpu/signal.c
> > @@ -130,6 +130,45 @@ static inline int copy_fpregs_to_sigframe(struct xregs_state __user *buf)
> > return err;
> > }
> >
> > +static int may_copy_fpregs_to_sigframe(void)
> > +{
> > + /*
> > + * In signal handling path, the kernel already checks if
> > + * FPU instructions have been used before it calls
> > + * copy_fpstate_to_sigframe(). We check this here again
> > + * to detect any potential mis-use and saving invalid
> > + * register values directly to a signal frame.
> > + */
> > + WARN_ONCE(!current->thread.fpu.fpstate_active,
> > + "direct FPU save with no math use\n");
>
> This is probably an OK check for this _particular_ context (since this
> context is all ready to copy_to_user() the fpu state). But is it good
> generally? Why couldn't you have a !fpstate_active thread that _was_
> fpregs_active?
>
> Such a thread _could_ do a direct XSAVE with no issues.
But it won't come to this function unless fpstate_active is ture?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-04-29 22:10 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-04-30 00:50 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-04-30 02:40 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-05-02 18:10 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-02 18:40 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-05-02 18:50 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-02 19:30 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-05-02 19:40 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-02 23:30 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-02 23:30 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-05-02 23:40 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-03 00:30 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Dave Hansen <dave.hansen@linux.intel.com> - 2016-05-03 00:40 +0200
Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-02 18:10 +0200
csiph-web