• Jeffrey Hugo's avatar
    efi/libstub: Allocate headspace in efi_get_memory_map() · b4bcdf68
    Jeffrey Hugo authored
    commit dadb57ab upstream.
    
    efi_get_memory_map() allocates a buffer to store the memory map that it
    retrieves.  This buffer may need to be reused by the client after
    ExitBootServices() is called, at which point allocations are not longer
    permitted.  To support this usecase, provide the allocated buffer size back
    to the client, and allocate some additional headroom to account for any
    reasonable growth in the map that is likely to happen between the call to
    efi_get_memory_map() and the client reusing the buffer.
    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>
    [bwh: Backported to 3.16:
     - Adjust filenames, context
     - In allocate_new_fdt_and_exit_boot(), only fill memory_map
     - Drop changes to efi_random_alloc()]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    b4bcdf68
eboot.c 35.8 KB