Re: [PATCH] efi: Include a .bss section within the PE/COFF headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



init_size does not include any kind of alignment padding.

On July 9, 2014 3:20:40 PM PDT, Michael Brown <mbrown@xxxxxxxxxxxxxxxx> wrote:
>On 09/07/14 22:41, Michael Brown wrote:
>> The PE/COFF headers currently describe only the initialised-data
>> portions of the image, and result in no space being allocated for the
>> uninitialised-data portions.  Consequently, the EFI boot stub will
>end
>> up overwriting unexpected areas of memory, with unpredictable
>results.
>>
>> Fix by including a .bss section in the PE/COFF headers (functionally
>> equivalent to the init_size field in the bzImage header).
>
>Following on from this: hpa mentioned via IRC that we should also take 
>alignment into account.  I am unsure if init_size already includes 
>padding for alignment; on my sample kernel init_size is >16MB (with
>16MB 
>alignment), so it looks plausible to me that alignment is already 
>accounted for.
>
>If not, then the following trivial patch exposes the desired alignment 
>via the PE/COFF headers:
>
>diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
>index 7a6d43a..16ef025 100644
>--- a/arch/x86/boot/header.S
>+++ b/arch/x86/boot/header.S
>@@ -154,7 +154,7 @@ extra_header_fields:
>  #else
>  	.quad	0				# ImageBase
>  #endif
>-	.long	0x20				# SectionAlignment
>+	.long	CONFIG_PHYSICAL_ALIGN		# SectionAlignment
>  	.long	0x20				# FileAlignment
>  	.word	0				# MajorOperatingSystemVersion
>  	.word	0				# MinorOperatingSystemVersion

-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux