Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1385917

Re: [PATCHv2 6/6] efi/runtime-wrappers: detect FW irq flag corruption

From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCHv2 6/6] efi/runtime-wrappers: detect FW irq flag corruption
Date 2016-04-24 23:20 +0200
Message-ID <rrzBD-2BD-5@gated-at.bofh.it> (permalink)
References <rqJMK-2OK-3@gated-at.bofh.it> <rqJMM-2OK-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 22 Apr, at 02:51:23PM, Mark Rutland wrote:
> The UEFI spec allows runtime services to be called with interrupts
> masked or unmasked, and if a runtime service function needs to mask
> interrupts, it must restore the mask to its original state before
> returning (i.e. from the PoV of the OS, this does not change across a
> call). Firmware should never unmask exceptions, as these may then be
> taken by the OS unexpectedly.
> 
> Unfortunately, some firmware has been seen to unmask IRQs (and
> potentially other maskable exceptions) across runtime services calls,
> leaving irq flags corrupted after returning from a runtime services
> function call. This may be detected by the IRQ tracing code, but often
> goes unnoticed, leaving a potentially disastrous bug hidden.
> 
> This patch detects when the irq flags are corrupted by an EFI runtime
> services call, logging the call and specific corruption to the console.
> While restoring the expected value of the flags is insufficient to avoid
> problems, we do so to avoid redundant warnings from elsewhere (e.g. IRQ
> tracing).
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: linux-efi@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/firmware/efi/runtime-wrappers.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> I'm not sure about the LOCKDEP_NOW_UNRELIABLE here. If FW unmasks IRQs there's
> the potential for deadlock, but arguably by the time we've detected the flag
> corruption the danger has passed. I'm erring on the side of caution here
> setting it, but perhaps that's not the best idea?

I think it makes sense to leave it as-is, not least to guard against
future changes we make to the kernel side that might have lockdep side
effects when this bug is triggered.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Mark Rutland <mark.rutland@arm.com> - 2016-04-22 16:00 +0200
  [PATCHv2 3/6] arm/efi: move to generic {__,}efi_call_virt Mark Rutland <mark.rutland@arm.com> - 2016-04-22 16:00 +0200
  [PATCHv2 6/6] efi/runtime-wrappers: detect FW irq flag corruption Mark Rutland <mark.rutland@arm.com> - 2016-04-22 16:00 +0200
    Re: [PATCHv2 6/6] efi/runtime-wrappers: detect FW irq flag corruption Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-24 23:20 +0200
  [PATCHv2 2/6] arm64/efi: move to generic {__,}efi_call_virt Mark Rutland <mark.rutland@arm.com> - 2016-04-22 16:00 +0200
  [PATCHv2 1/6] efi/runtime-wrappers: add {__,}efi_call_virt templates Mark Rutland <mark.rutland@arm.com> - 2016-04-22 16:00 +0200
    Re: [PATCHv2 1/6] efi/runtime-wrappers: add {__,}efi_call_virt  templates Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-24 23:20 +0200
  Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-04-22 16:20 +0200
    Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-24 23:30 +0200
      Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-25 12:20 +0200
        Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-04-25 12:30 +0200
          Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-25 12:30 +0200
            Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Mark Rutland <mark.rutland@arm.com> - 2016-04-25 12:50 +0200
              Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-25 13:00 +0200
                Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Mark Rutland <mark.rutland@arm.com> - 2016-04-25 13:10 +0200
                Re: [PATCHv2 0/6] efi: detect erroneous firmware IRQ manipulation Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-25 13:20 +0200

csiph-web