Thanks for the patch, it was applied...

-Ning 

-----Original Message-----
From: Sahil Rihan [mailto:sri...@fb.com] 
Sent: Saturday, September 30, 2017 1:38 PM
To: tboot-devel@lists.sourceforge.net
Subject: [tboot-devel] Correctly calculate EFI memory map size

The size field of the MB2 tag is the size of the tag header + the size of the 
memmap entries. So we need to subtract the size of the header before returning 
the memmap size.

Test Plan: Boot with 4.11 kernel. Verify system boots correctly and "Invalid 
EFI memory map entries" message is not present in dmesg.

Signed-off-by: Sahil Rihan <sri...@fb.com>

tboot/common/loader.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tboot/common/loader.c b/tboot/common/loader.c index 
88d6d30..dec80d8 100644
--- a/tboot/common/loader.c
+++ b/tboot/common/loader.c
@@ -1915,8 +1915,12 @@ find_efi_memmap(loader_ctx *lctx, uint32_t *descr_size,
     efi_mmap = (struct mb2_tag_efi_mmap *)hit;
     *descr_size = efi_mmap->descr_size;
     *descr_vers = efi_mmap->descr_vers;
-    *mmap_size = efi_mmap->size;
-    return (uint32_t)(&efi_mmap->efi_mmap);
+    *mmap_size = efi_mmap->size - sizeof(struct mb2_tag_efi_mmap);
+    if (*mmap_size % *descr_size) {
+        printk(TBOOT_WARN "EFI memmmap (0x%x) should be a multiple of 
descriptor size (0x%x)\n",
+                     *mmap_size, *descr_size);
+    }
+    return (uint32_t)(&efi_mmap->efi_mmap);
 }

 bool


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech 
sites, Slashdot.org! http://sdm.link/slashdot 
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to