Re: [PATCH 01/17] x86, fpu: wrap get_xsave_addr() to make it safer

Dave Hansen
2015-03-25T14:28:52Z

On 03/25/2015 05:45 AM, Oleg Nesterov wrote:
> So far I do not understand this discussion ;) I didn't see the patches
> and other emails...

Hi Oleg,

My patch set apparently didn't make it to LKML, but here are the two
relevant ones. We're essentially replacing the MPX use of
fpu_save_init(). CPUs with MPX should entirely have eager FPU mode on.
But, the edges of the MPX code (do_bounds()) will call this to
distinguish a plain #BR exception from a #BR caused by MPX. It may get
called on CPUs without eager FPU mode on.

> http://git.kernel.org/cgit/linux/kernel/git/daveh/x86-mpx.git/commit/?h=mpx-v16&id=92d3e7c1664f766142904904e27e126888adb8a7
> http://git.kernel.org/cgit/linux/kernel/git/daveh/x86-mpx.git/commit/?h=mpx-v16&id=18049953ae43a7ffa084a01613c1684bdf24dd2e

All that the MPX code wants here is to read the in-memory copy of the
MPX registers, or error out.

So, for the purposes of this series:

With the (so far unmerged to Linus's tree) changes to unlazy_fpu(), does
tsk_get_xsave_field()'s use of unlazy_fpu() look correct?

Should we also be renaming tsk_get_xsave_field() to something more
appropriate?