public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Borislav Petkov <bp@suse.de>, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	ricardo.neri-calderon@linux.intel.com, tglx@linutronix.de,
	matt.fleming@intel.com, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/efi] x86/efi: Check for unsafe dealing with FPU state in irq ctxt
Date: Wed, 04 Jun 2014 17:19:01 -0700	[thread overview]
Message-ID: <538FB775.8070405@amacapital.net> (raw)
In-Reply-To: <20140604224920.GB4126@pd.tnic>

On 06/04/2014 03:49 PM, Borislav Petkov wrote:
> On Wed, Jun 04, 2014 at 03:17:30PM -0700, H. Peter Anvin wrote:
>> I seem to have lost track of this... does this actually solve
>> anything, or does it just mean we'll explode hard?
> 
> Not that hard - it'll warn once only.
> 
> AFAIR, the discussion stalled but we were going in the direction of not
> calling into efi from pstore in irq context.

The kernel_fpu_begin thing has annoyed me in the past.  How bad would it
be to allocate some percpu space and just do a full save/restore when
kernel_fpu_begin happens in a context where it currently doesn't work?

I don't know how large the state is these days, but there must be some
limit to how deeply interrupts and exceptions can nest.  For each IST
entry, there is a hard limit to how deeply they can nest (once for all
but debug and four times for debug IIRC), plus one NMI (nested ones
don't touch FPU).  The most non-IST entries we can have must be bounded,
too.

Let's say there are at most 16 levels of nesting.  16 * state size *
cpus isn't that much.

Of course, code in interrupts that nests kernel_fpu_begin itself could
have a problem.  But this can be solved with a little bit of trickery in
the entry code or something.


If we did this, then I think the x86 crypto code could get rid of all of
its ridiculous async code.

--Andy

  parent reply	other threads:[~2014-06-05  0:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-baa916f39b50ad91661534652110df40396acda0@git.kernel.org>
2014-06-04 22:17 ` [tip:x86/efi] x86/efi: Check for unsafe dealing with FPU state in irq ctxt H. Peter Anvin
2014-06-04 22:49   ` Borislav Petkov
2014-06-04 22:52     ` H. Peter Anvin
2014-06-05  0:19     ` Andy Lutomirski [this message]
2014-06-05  7:18       ` Borislav Petkov
2014-06-05  8:49         ` Matt Fleming
2014-06-05  9:02           ` Borislav Petkov
2014-06-05 15:44             ` Andy Lutomirski
2014-06-05 15:53               ` Borislav Petkov
2014-06-05 16:01                 ` Andy Lutomirski
2014-06-05 16:08                   ` Borislav Petkov
2014-06-05 16:14                     ` Andy Lutomirski
2014-06-05 16:18                       ` Borislav Petkov
2014-06-05 16:31                         ` H. Peter Anvin
2014-06-05 16:35                           ` Andy Lutomirski
2014-06-05 16:43                             ` H. Peter Anvin
2014-06-05 16:37                           ` Borislav Petkov
2014-06-05 16:43                             ` H. Peter Anvin
2014-06-05 16:44                               ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538FB775.8070405@amacapital.net \
    --to=luto@amacapital.net \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mingo@kernel.org \
    --cc=ricardo.neri-calderon@linux.intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox