diff mbox

[v2,05/14] arm64: efi: remove forbidden values from the PE/COFF header

Message ID 1486554947-3964-6-git-send-email-ard.biesheuvel@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ard Biesheuvel Feb. 8, 2017, 11:55 a.m. UTC
Bring the PE/COFF header in line with the PE/COFF spec, by setting
NumberOfSymbols to 0, and removing the section alignment flags.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/kernel/efi-header.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mark Rutland Feb. 10, 2017, 10:13 a.m. UTC | #1
On Wed, Feb 08, 2017 at 11:55:38AM +0000, Ard Biesheuvel wrote:
> Bring the PE/COFF header in line with the PE/COFF spec, by setting
> NumberOfSymbols to 0, and removing the section alignment flags.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

I take it that in practice EFI implementations don't care about these?
Assuming so:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Otherwise, we might want to fix this first, so that we can easily
backport it.

Thanks,
Mark.

> ---
>  arch/arm64/kernel/efi-header.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S
> index 9b24ce130afb..515624bbfcd0 100644
> --- a/arch/arm64/kernel/efi-header.S
> +++ b/arch/arm64/kernel/efi-header.S
> @@ -15,7 +15,7 @@ coff_header:
>  	.short	2					// nr_sections
>  	.long	0 					// TimeDateStamp
>  	.long	0					// PointerToSymbolTable
> -	.long	1					// NumberOfSymbols
> +	.long	0					// NumberOfSymbols
>  	.short	section_table - optional_header		// SizeOfOptionalHeader
>  	.short	0x206					// Characteristics.
>  							// IMAGE_FILE_DEBUG_STRIPPED |
> @@ -88,7 +88,7 @@ section_table:
>  	.long	0					// PointerToLineNumbers
>  	.short	0					// NumberOfRelocations
>  	.short	0					// NumberOfLineNumbers
> -	.long	0x42100040				// Characteristics (section flags)
> +	.long	0x42000040				// Characteristics (section flags)
>  
>  
>  	.ascii	".text"
> @@ -104,7 +104,7 @@ section_table:
>  	.long	0					// PointerToLineNumbers
>  	.short	0					// NumberOfRelocations
>  	.short	0					// NumberOfLineNumbers
> -	.long	0xe0500020				// Characteristics
> +	.long	0xe0000020				// Characteristics
>  
>  #ifdef CONFIG_DEBUG_EFI
>  	/*
> -- 
> 2.7.4
>
Ard Biesheuvel Feb. 10, 2017, 2:31 p.m. UTC | #2
On 10 February 2017 at 10:13, Mark Rutland <mark.rutland@arm.com> wrote:
> On Wed, Feb 08, 2017 at 11:55:38AM +0000, Ard Biesheuvel wrote:
>> Bring the PE/COFF header in line with the PE/COFF spec, by setting
>> NumberOfSymbols to 0, and removing the section alignment flags.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> I take it that in practice EFI implementations don't care about these?

Not at all. I just spotted it when I was cleaning up the header.

> Assuming so:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
>
> Otherwise, we might want to fix this first, so that we can easily
> backport it.
>

I wouldn't bother
diff mbox

Patch

diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S
index 9b24ce130afb..515624bbfcd0 100644
--- a/arch/arm64/kernel/efi-header.S
+++ b/arch/arm64/kernel/efi-header.S
@@ -15,7 +15,7 @@  coff_header:
 	.short	2					// nr_sections
 	.long	0 					// TimeDateStamp
 	.long	0					// PointerToSymbolTable
-	.long	1					// NumberOfSymbols
+	.long	0					// NumberOfSymbols
 	.short	section_table - optional_header		// SizeOfOptionalHeader
 	.short	0x206					// Characteristics.
 							// IMAGE_FILE_DEBUG_STRIPPED |
@@ -88,7 +88,7 @@  section_table:
 	.long	0					// PointerToLineNumbers
 	.short	0					// NumberOfRelocations
 	.short	0					// NumberOfLineNumbers
-	.long	0x42100040				// Characteristics (section flags)
+	.long	0x42000040				// Characteristics (section flags)
 
 
 	.ascii	".text"
@@ -104,7 +104,7 @@  section_table:
 	.long	0					// PointerToLineNumbers
 	.short	0					// NumberOfRelocations
 	.short	0					// NumberOfLineNumbers
-	.long	0xe0500020				// Characteristics
+	.long	0xe0000020				// Characteristics
 
 #ifdef CONFIG_DEBUG_EFI
 	/*