On 04/21/2015 09:51 PM, Fenghua Yu wrote:
> +     /*
> +      * Clear xcomp_bv[63] in user's xsave area header to indicate
> +      * buf_fx is in standard format.
> +      */
> +     xcomp_bv = xsave->xsave_hdr.xcomp_bv;
> +     user_xsave = buf_fx;
> +     xcomp_bv &= ~((u64)1 << 63);

I ran in to another bug.  xrestor_user() is hitting a #GP with these values:

[    6.258743] xrestore_user() tmp: ffff88003f813000
[    6.261122]       XCR0: 000000000000001f
[    6.261868]  xstate_bv: 0000000000000003
[    6.262613]   xcomp_bv: 000000000000001f

I think it is because bit 63 is clear in xcomp_bv, but there are other
bits set in there.

I think the above needs to just do:

        /*
         * We are uncompacting the state for the user buffer.  We need
         * to clear out the xcomp_bv field entirely.  The uncompacted
         * form of xsave/xrstor treats this field as reserved.
         */
        if (__put_user(0, &user_xsave->xsave_hdr.xcomp_bv))
                return -1;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to