[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUxfd8brhWzBJSsSA=M1OHOSUWtu73gosPGZV9QgM6Z4Q@mail.gmail.com>
Date: Tue, 24 Mar 2015 16:52:19 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
X86 ML <x86@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Rik van Riel <riel@...hat.com>,
Suresh Siddha <sbsiddha@...il.com>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Fenghua Yu <fenghua.yu@...el.com>
Subject: Re: [PATCH 01/17] x86, fpu: wrap get_xsave_addr() to make it safer
On Tue, Mar 24, 2015 at 4:42 PM, Dave Hansen <dave.hansen@...el.com> wrote:
> On 03/24/2015 03:28 PM, Andy Lutomirski wrote:
>> Your function appears to be getting it for write (I assume that's what
>> the unlazy_fpu is for), so I'd rather have it called
>> tsk_get_xsave_field_for_write or something like that.
>
> It should be entirely read-only.
>
> For MPX (the only user of get_xsave_addr() iirc), we are only worried
> about getting the status codes (and addresses) out of the bndstatus
> register and making sure that the kernel-recorded bounds directory
> address matches the bndcfgu (configuration) register.
>
> We don't ever write to the registers.
So why are you unlazying it?
IIUC, the xstae for current can be in one of three logical states:
1. Live in CPU regs. The in-memory copy is garbage and the state is
in CPU regs.
2. Lazy. The in-memory copy and the CPU regs match. Writing to
either copy is illegal.
3. In memory only. Writing to the in-memory copy is safe.
IIUC, you want to read the xstate, do you're okay with #2 or #3. This
would be tsk_get_xsave_field_for_read in my terminology.
If you want to write the xstate, you'd need to be in state #3, which
would be tsk_get_xsave_field_for_write.
IIUC, unlazy_fpu just moves from from state 2 to 3.
I could be totally wrong for any number of reasons, though.
--Andy
--
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists