public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/7] arm64: efi: ensure that the PE/COFF header pointer appears at offset 0x3c
Date: Mon, 6 Feb 2017 17:05:00 +0000	[thread overview]
Message-ID: <20170206170500.GE4190@leverpostej> (raw)
In-Reply-To: <1486398275-3966-5-git-send-email-ard.biesheuvel@linaro.org>

On Mon, Feb 06, 2017 at 04:24:32PM +0000, Ard Biesheuvel wrote:
> Use a .org directive to ensure that the PE/COFF header pointer appears
> at offset 0x3c. Since the EFI header is now emitted using a macro, this
> helps ensure that the invocation of the macro remains at the correct
> offset.
> 
> At the same time, collapse two adjacent #ifdef CONFIG_EFI blocks into one,
> and replace .word with .long (which are equivalent, but the former is
> never used elsewhere)
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

As with patch 3, I would very much prefer that we left these bits in
head.S.

Thanks,
Mark.

> ---
>  arch/arm64/kernel/efi-header.S | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S
> index 8c8cd0a8192b..74a25c09a1b8 100644
> --- a/arch/arm64/kernel/efi-header.S
> +++ b/arch/arm64/kernel/efi-header.S
> @@ -22,14 +22,16 @@
>  	.endm
>  
>  	.macro	__EFI_HEADER
> -#ifdef CONFIG_EFI
> -	.long	pe_header - _head		// Offset to the PE header.
> +#ifndef CONFIG_EFI
> +	.long	0				// reserved
>  #else
> -	.word	0				// reserved
> -#endif
> +	/*
> +	 * PE/COFF requires the offset to the PE header
> +	 * to be stored at offset 0x3c into the file.
> +	 */
> +	.org	_head + 0x3c
> +	.long	pe_header - _head		// Offset to the PE header.
>  
> -#ifdef CONFIG_EFI
> -	.align 3
>  pe_header:
>  	.ascii	"PE"
>  	.short 	0
> -- 
> 2.7.4
> 

  reply	other threads:[~2017-02-06 17:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 16:24 [PATCH 0/7] arm64: efi: PE/COFF cleanup/hardening Ard Biesheuvel
2017-02-06 16:24 ` [PATCH 1/7] include: pe.h: allow for use in assembly Ard Biesheuvel
2017-02-06 16:33   ` Mark Rutland
2017-02-06 16:40     ` Ard Biesheuvel
2017-02-06 16:24 ` [PATCH 2/7] include: pe.h: add some missing definitions Ard Biesheuvel
2017-02-06 16:24 ` [PATCH 3/7] arm64: efi: move EFI header and related data to a separate .S file Ard Biesheuvel
2017-02-06 17:03   ` Mark Rutland
2017-02-06 17:07     ` Ard Biesheuvel
2017-02-06 16:24 ` [PATCH 4/7] arm64: efi: ensure that the PE/COFF header pointer appears at offset 0x3c Ard Biesheuvel
2017-02-06 17:05   ` Mark Rutland [this message]
2017-02-06 16:24 ` [PATCH 5/7] arm64: efi: remove pointless dummy .reloc section Ard Biesheuvel
2017-02-06 17:06   ` Mark Rutland
2017-02-07 18:30   ` Peter Jones
2017-02-06 16:24 ` [PATCH 6/7] arm64: efi: replace open coded constants with symbolic ones Ard Biesheuvel
2017-02-06 17:13   ` Mark Rutland
2017-02-06 16:24 ` [PATCH 7/7] arm64: efi: split Image code and data into separate PE/COFF sections Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170206170500.GE4190@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox