[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVqqgExhuAYawh_7tc8-Nm8GGiMxmtw25mLFoxru-odZg@mail.gmail.com>
Date: Thu, 5 Jun 2014 09:01:02 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Borislav Petkov <bp@...en8.de>
Cc: Matt Fleming <matt.fleming@...el.com>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"linux-tip-commits@...r.kernel.org"
<linux-tip-commits@...r.kernel.org>
Subject: Re: [tip:x86/efi] x86/efi: Check for unsafe dealing with FPU state in
irq ctxt
On Thu, Jun 5, 2014 at 8:53 AM, Borislav Petkov <bp@...en8.de> wrote:
> On Thu, Jun 05, 2014 at 08:44:20AM -0700, Andy Lutomirski wrote:
>> Are there weird contexts from which EFI calls can happen? It looks
>> like the current code isn't necessarily safe in things that aren't
>> normal process context but aren't interrupts either (e.g. debug traps,
>> #GP, etc).
>
> The efi-pstore thing registers as a kmsg dumper which can be run in NMI
> context and efi can be called there.
NMI might be okay. I haven't checked.
>
>> I wonder if it would make sense at some point to maintain an explicit
>> stack of kernel entries. There doesn't seem to be a reliable way to
>> answer the question of "what context am I in" from C code right now.
>
> So that you can ask int ctxt = what_context_Im_in() and then that
> context can go and change right underneath you. :-)
>
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
// kprobe changes the context back
use the FPU. Life is good.
put_back_the_fpu(ctxt);
--Andy
--
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