public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: vmlinux.lds: make __rela_offset and __dynsym_offset ABSOLUTE
Date: Fri, 29 Jul 2016 10:06:35 +0100	[thread overview]
Message-ID: <20160729090634.GA16593@arm.com> (raw)
In-Reply-To: <1469715314-23260-1-git-send-email-ard.biesheuvel@linaro.org>

Hi Ard,

On Thu, Jul 28, 2016 at 04:15:14PM +0200, Ard Biesheuvel wrote:
> Due to the untyped KIMAGE_VADDR constant, the linker may not notice
> that the __rela_offset and __dynsym_offset expressions are absolute
> values (i.e., are not subject to relocation). This does not matter for
> KASLR, but it does confuse kallsyms in relative mode, since it uses
> the lowest non-absolute symbol address as the anchor point, and expects
> all other symbol addresses to be within 4 GB of it.
> 
> Fix this by qualifying these expressions as ABSOLUTE() explicitly.
> 
> Fixes: 0cd3defe0af4 ("arm64: kernel: perform relocation processing from ID map")
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/arm64/kernel/vmlinux.lds.S | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> index 89d6e177ecbd..d49492179967 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
> @@ -184,9 +184,9 @@ SECTIONS
>  		*(.hash)
>  	}
>  
> -	__rela_offset	= ADDR(.rela) - KIMAGE_VADDR;
> +	__rela_offset	= ABSOLUTE(ADDR(.rela) - KIMAGE_VADDR);
>  	__rela_size	= SIZEOF(.rela);
> -	__dynsym_offset	= ADDR(.dynsym) - KIMAGE_VADDR;
> +	__dynsym_offset	= ABSOLUTE(ADDR(.dynsym) - KIMAGE_VADDR);

You removed the __dynsym_offset entry entirely in "arm64: relocatable:
suppress R_AARCH64_ABS64 relocations in vmlinux", so I'll drop this part
of the patch and assume you'll do a separate backport for stable. Ok?

Will

  reply	other threads:[~2016-07-29  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 14:15 [PATCH] arm64: vmlinux.lds: make __rela_offset and __dynsym_offset ABSOLUTE Ard Biesheuvel
2016-07-29  9:06 ` Will Deacon [this message]
2016-07-29  9:30   ` Ard Biesheuvel
2016-07-29 10:46     ` Ard Biesheuvel
2016-07-29 10:49       ` Will Deacon
2016-07-29 10:52         ` Ard Biesheuvel
2016-07-29 10:57           ` Will Deacon
2016-07-29 11:01             ` 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=20160729090634.GA16593@arm.com \
    --to=will.deacon@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