Skip to content

Commit ccf3051

Browse files
committed
pe: Fix PF in GRUB after memattrs call
The call to update_mem_attrs() takes an aligned pointer within an allocated region but passes the entire size of the allocated region. The result is that Shim may remove execute permission from some pages belonging to GRUB causing a page fault upon returning from the LoadImage call. Signed-off-by: Ross Lagerwall <[email protected]>
1 parent afc4955 commit ccf3051

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ handle_image (void *data, unsigned int datasize,
717717
dprint(L"Loading 0x%llx bytes at 0x%llx\n",
718718
(unsigned long long)context.ImageSize,
719719
(unsigned long long)(uintptr_t)buffer);
720-
update_mem_attrs((uintptr_t)buffer, alloc_size, MEM_ATTR_R|MEM_ATTR_W,
720+
update_mem_attrs((uintptr_t)buffer, context.ImageSize, MEM_ATTR_R|MEM_ATTR_W,
721721
MEM_ATTR_X);
722722

723723
CopyMem(buffer, data, context.SizeOfHeaders);

0 commit comments

Comments
 (0)