• J
    efi/libstub: Introduce ExitBootServices helper · fc07716b
    Jeffrey Hugo 提交于
    The spec allows ExitBootServices to fail with EFI_INVALID_PARAMETER if a
    race condition has occurred where the EFI has updated the memory map after
    the stub grabbed a reference to the map.  The spec defines a retry
    proceedure with specific requirements to handle this scenario.
    
    This scenario was previously observed on x86 - commit d3768d88 ("x86,
    efi: retry ExitBootServices() on failure") but the current fix is not spec
    compliant and the scenario is now observed on the Qualcomm Technologies
    QDF2432 via the FDT stub which does not handle the error and thus causes
    boot failures.  The user will notice the boot failure as the kernel is not
    executed and the system may drop back to a UEFI shell, but will be
    unresponsive to input and the system will require a power cycle to recover.
    
    Add a helper to the stub library that correctly adheres to the spec in the
    case of EFI_INVALID_PARAMETER from ExitBootServices and can be universally
    used across all stub implementations.
    Signed-off-by: NJeffrey Hugo <jhugo@codeaurora.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Leif Lindholm <leif.lindholm@linaro.org>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
    fc07716b
efi-stub-helper.c 19.5 KB