EFI changes for v3.16
Folks, please queue the following change for v3.16 from Borislav that uses the more strict kernel_fpu_{begin,end}() instead of the __* verisons that won't catch buggy use in interrupt context.
The following changes since commit e33655a386ed3b26ad36fb97a47ebb1c2ca1e928:
efivars: Add compatibility code for compat tasks (2014-04-17 13:53:53 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git tags/efi-next
for you to fetch changes up to baa916f39b50ad91661534652110df40396acda0:
x86/efi: Check for unsafe dealing with FPU state in irq ctxt (2014-05-03 06:39:25 +0100)
----------------------------------------------------------------
* Use the more strict FPU handling functions before invoking EFI services to catch misuse in irq context - Borislav Petkov
----------------------------------------------------------------
Borislav Petkov (1):
x86/efi: Check for unsafe dealing with FPU state in irq ctxt
arch/x86/include/asm/efi.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Quoted 12 lines · Matt Fleming
Folks, please queue the following change for v3.16 from Borislav that uses the more strict kernel_fpu_{begin,end}() instead of the __* verisons that won't catch buggy use in interrupt context.
The following changes since commit
e33655a386ed3b26ad36fb97a47ebb1c2ca1e928:efivars: Add compatibility code for compat tasks (2014-04-17 13:53:53 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.gittags/efi-next
Quoted 7 lines
for you to fetch changes up to
baa916f39b50ad91661534652110df40396acda0:x86/efi: Check for unsafe dealing with FPU state in irq ctxt (2014-05-03 06:39:25 +0100)
----------------------------------------------------------------
* Use the more strict FPU handling functions before invoking EFI services to catch misuse in irq context - Borislav Petkov
Ping?
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Quoted 21 lines · Matt Fleming
Quoted 12 lines · Matt Fleming
Folks, please queue the following change for v3.16 from Borislav that uses the more strict kernel_fpu_{begin,end}() instead of the __* verisons that won't catch buggy use in interrupt context.
The following changes since commit
e33655a386ed3b26ad36fb97a47ebb1c2ca1e928:efivars: Add compatibility code for compat tasks (2014-04-17 13:53:53 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.gittags/efi-nextQuoted 7 lines
for you to fetch changes up to
baa916f39b50ad91661534652110df40396acda0:x86/efi: Check for unsafe dealing with FPU state in irq ctxt (2014-05-03 06:39:25 +0100)
----------------------------------------------------------------
* Use the more strict FPU handling functions before invoking EFI services to catch misuse in irq context - Borislav Petkov
Quoted 7 lines
Ping?
efi_callcan happen in an irq context (pstore) and there we really need to make sure we're not scribbling over FPU state while we've interrupted a thread or kernel mode with a live FPU state. Therefore, use the kernel_fpu_begin/end() variants which do that check.
How on earth does this solve anything? The only thing we add here is a WARN_ON_ONCE()... but the above text already tells us we have a problem.
It seems, rather, that we need to figure out how to deal with a pstore in this case. There are a few possibilities:
1. We could keep an XSAVE buffer area around for this particular use. I am *assuming* we don't let more than one CPU into EFI, because I cannot for my life imagine that this is safe in typical CPUs.
2. Drop the pstore on the floor if !irq_fpu_usable().
3. Allow the pstore, then die (on the assumption that we're dead anyway.)
Comments?
-hpa
Quoted 15 lines · H. Peter Anvin
Quoted 4 lines
efi_callcan happen in an irq context (pstore) and there we really need to make sure we're not scribbling over FPU state while we've interrupted a thread or kernel mode with a live FPU state. Therefore, use the kernel_fpu_begin/end() variants which do that check.How on earth does this solve anything? The only thing we add here is a
WARN_ON_ONCE()... but the above text already tells us we have a problem.It seems, rather, that we need to figure out how to deal with a pstore in this case. There are a few possibilities:
1. We could keep an XSAVE buffer area around for this particular use. I am *assuming* we don't let more than one CPU into EFI, because I cannot for my life imagine that this is safe in typical CPUs.
Quoted 6 lines
2. Drop the pstore on the floor if !irq_fpu_usable().
3. Allow the pstore, then die (on the assumption that we're dead anyway.)
Comments?
The question is, why can't that pstore mumbo jumbo go and do its dance in !irq context?
And how useful is the whole deal really, btw? I wanted to use it for saving oopses into it, for example, but Tony said its write speed is horribly low for that.
So why do we even bother with this thing and do the dance in irq context for it? Is it worth it at all?
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Quoted 11 lines · Borislav Petkov
The question is, why can't that pstore mumbo jumbo go and do its dance in !irq context?
And how useful is the whole deal really, btw? I wanted to use it for saving oopses into it, for example, but Tony said its write speed is horribly low for that.
So why do we even bother with this thing and do the dance in irq context for it? Is it worth it at all?
I thought the whole point of allowing pstore in IRQ context was to write oopsen (panics?)
-hpa
Quoted 2 lines · H. Peter Anvin
I thought the whole point of allowing pstore in IRQ context was to write oopsen (panics?)
Right, so Tony meant last time we were talking about it that nvram is too slow for collecting the whole dmesg into it (could mess up timing and such - although, come to think of it, we do have CONFIG_PRINTK_TIME so we can sort them if they're out of order...)
So what I'm questioning is whether a single oops/panic can be written out to nvram reliably too?
Because if not, then the problem we're trying to solve is moot and beside the point - maybe we should not use EFI as a pstore backend in irq context at all?
I'm just putting it on the table so that we have talked about it too, before devising a solution.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Quoted 10 lines · H. Peter Anvin
How on earth does this solve anything? The only thing we add here is a
WARN_ON_ONCE()... but the above text already tells us we have a problem.It seems, rather, that we need to figure out how to deal with a pstore in this case. There are a few possibilities:
1. We could keep an XSAVE buffer area around for this particular use. I am *assuming* we don't let more than one CPU into EFI, because I cannot for my life imagine that this is safe in typical CPUs.
Correct. This is actually prohibited by the spec, so we have a lock to enforce it.
Quoted 4 lines
2. Drop the pstore on the floor if !irq_fpu_usable().
3. Allow the pstore, then die (on the assumption that we're dead anyway.)
Personally, I'd prefer 2, but I'm open to suggestions.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center