[PATCH v2 4/5] efi: implement generic support for the Memory Attributes table

Ard Biesheuvel ard.biesheuvel at linaro.org
Wed Apr 13 01:29:23 PDT 2016

On 12 April 2016 at 21:57, Matt Fleming <matt at codeblueprint.co.uk> wrote:
> On Mon, 11 Apr, at 04:09:11PM, Ard Biesheuvel wrote:
>> The spec does not actually mandate that, and I do know that the
>> Tianocore code deliberately uses a larger value for desc_size in
>> GetMemoryMap() to catch inadvertent uses of sizeof(). I am not sure if
>> the memory attribute table code does the same, and it seems dangerous
>> to assume that to be the case in general.
> The spec may not mandate that, but this code will explode horribly if
> efi_memory_desc_t does not accurately describe the entries in either
> the EFI Memory Attributes table or the EFI memory map.
> How do we ensure that doing,
> static bool entry_is_valid(...)
> {
>         *out = *in;
>         ...
> keeps working? Are we using the table version to guarantee that?

I think it is implied by the spec that this table and the one returned
by GetMemoryMap() use mutually compatible definitions of
EFI_MEMORY_DESCRIPTOR. However, since our definition of the struct
type is based on version 1, we should perhaps add a check for that

More information about the linux-arm-kernel mailing list