Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565068

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

From Dave Hansen <dave.hansen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area
Date 2017-01-23 16:40 +0100
Message-ID <t2OSS-8bq-35@gated-at.bofh.it> (permalink)
References <t2mae-73t-7@gated-at.bofh.it> <t2IaJ-44k-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/23/2017 12:28 AM, tip-bot for Kevin Hao wrote:
> x86/fpu: Set the xcomp_bv when we fake up a XSAVES area
> 
> I got the following calltrace on a Apollo Lake SoC with 32-bit kernel:

...
> --- a/arch/x86/kernel/fpu/xstate.c
> +++ b/arch/x86/kernel/fpu/xstate.c
> @@ -1070,6 +1070,7 @@ int copyin_to_xsaves(const void *kbuf, const void __user *ubuf,
>  	 * Add back in the features that came in from userspace:
>  	 */
>  	xsave->header.xfeatures |= xfeatures;
> +	xsave->header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | xsave->header.xfeatures;
>  
>  	return 0;
>  }

First of all, thanks for finding this!  As you found, the 32-bit XSAVES
code is a bit light on testing.

I don't doubt that we have a code path that was screwed up like this,
but I don't think this is the right fix.

The kernel xsave buffer should *ALWAYS* have the
XCOMP_BV_COMPACTED_FORMAT bit set.  It should have been set before the
copyin and it should be set when it's finished.

The best fix here would be not to paper over the issue in the copy
function but find where it got clobbered, or where some initialization
code failed to set it.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] x86/fpu: set the xcomp_bv when we fake up a XSAVES area Kevin Hao <haokexin@gmail.com> - 2017-01-22 10:00 +0100
  [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES  area tip-bot for Kevin Hao <tipbot@zytor.com> - 2017-01-23 09:30 +0100
    Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-23 16:40 +0100
      Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Yu-cheng Yu <yu-cheng.yu@intel.com> - 2017-01-23 18:00 +0100
        Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-23 18:30 +0100
          Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Yu-cheng Yu <yu-cheng.yu@intel.com> - 2017-01-23 22:10 +0100
            Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-23 22:20 +0100
              Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Yu-cheng Yu <yu-cheng.yu@intel.com> - 2017-01-23 22:30 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-23 22:30 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Kevin Hao <haokexin@gmail.com> - 2017-01-24 01:20 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-24 02:00 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Kevin Hao <haokexin@gmail.com> - 2017-01-24 03:00 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-24 03:10 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Kevin Hao <haokexin@gmail.com> - 2017-01-24 03:20 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-24 03:40 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Kevin Hao <haokexin@gmail.com> - 2017-01-24 06:20 +0100
                Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a  XSAVES area Ingo Molnar <mingo@kernel.org> - 2017-01-24 09:10 +0100
  [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES  area tip-bot for Kevin Hao <tipbot@zytor.com> - 2017-01-23 10:50 +0100

csiph-web