Re: [tip:x86/efi] x86/efi: Check for unsafe dealing with FPU state in irq ctxt
From: Borislav Petkov
Date: Thu Jun 05 2014 - 12:11:13 EST
On Thu, Jun 05, 2014 at 09:01:02AM -0700, Andy Lutomirski wrote:
> NMI might be okay. I haven't checked.
Well, if efi decides to do FPU math and it happens in NMI, we will have
to provide for proper contexts handling.
> It has to change back, though. Completely unrealistic and useless example:
>
> int ctxt = what_context_im_in();
>
> set_up_the_fpu(ctxt);
>
> // kprobe fires and changes the context
> // kprobe does something
And since we're being completely unrealistic, kprobe decides to use the
fpu too and uses it...
> // kprobe changes the context back
>
> use the FPU. Life is good.
>
> put_back_the_fpu(ctxt);
So you probably need some way of mapping preallocated, per-cpu FPU
contexts to their users which can get and put them.
It's a whole different question whether that makes sense though, at all
or we simply remain conservative and don't do any efi in NMI context...
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/