• Jeffrey Hugo's avatar
    efi/libstub: Introduce ExitBootServices helper · 99d1ddb2
    Jeffrey Hugo authored
    commit fc07716b upstream.
    
    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: default avatarJeffrey 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>
    Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    99d1ddb2
efi.h 40.2 KB