summaryrefslogtreecommitdiffstats
path: root/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/chainloader-Don-t-check-empty-section-in-file-like-..patch
blob: 482ca5cdc0158642e6380d2d1733593646ba8a2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From d3a1198bfc671530ed77ad2b81b0ae4582f9378e Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com>
Date: Sun, 24 Apr 2016 15:56:38 +0800
Subject: [PATCH] chainloader: Don't check empty section in file like .bss

Upstream-Status: Pending

Because this kind of section always has a zeroed PointerToRawData denoting
the offset to file and a valid VirtualSize denoting the real size in the
memory.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
---
 grub-core/loader/efi/chainloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 2d8edc0..0e84100 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -526,7 +526,7 @@ grub_shim_load_image(grub_addr_t addr, grub_ssize_t size,
 	 }
 
 	if (section->virtual_address < context->header_size
-	    || section->raw_data_offset < context->header_size)
+	    || (section->raw_data_offset && section->raw_data_offset < context->header_size))
 	  {
 	    grub_printf("Section is inside image headers\n");
 	    status = GRUB_ERR_BAD_FILE_TYPE;
-- 
1.9.1