From: Will Deacon <will.deacon@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: catalin.marinas@arm.com, Peter Smith <peter.smith@linaro.org>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: relocatable: fix inconsistencies in linker script and options
Date: Tue, 4 Dec 2018 14:17:44 +0000 [thread overview]
Message-ID: <20181204141744.GA6269@arm.com> (raw)
In-Reply-To: <20181203195805.28835-1-ard.biesheuvel@linaro.org>
Hey Ard,
On Mon, Dec 03, 2018 at 08:58:05PM +0100, Ard Biesheuvel wrote:
> readelf complains about the section layout of vmlinux when building
> with CONFIG_RELOCATABLE=y (for KASLR):
>
> readelf: Warning: [21]: Link field (0) should index a symtab section.
> readelf: Warning: [21]: Info field (0) should index a relocatable section.
>
> Also, it seems that our use of '-pie -shared' is contradictory, and
> thus ambiguous. In general, the way KASLR is wired up at the moment
> is highly tailored to how ld.bfd happens to implement (and conflate)
> PIE executables and shared libraries, so given the current effort to
> support other toolchains, let's fix some of these issues as well.
>
> - Drop the -pie linker argument and just leave -shared. In ld.bfd,
> the differences between them are unclear (except for the ELF type
> of the produced image [0]) but lld chokes on seeing both at the
> same time.
>
> - Rename the .rela output section to .rela.dyn, as is customary for
> shared libraries and PIE executables, so that it is not misidentified
> by readelf as a static relocation section (producing the warnings
> above).
>
> - Pass the -z notext and -z norelro options to explicitly instruct the
> linker to permit text relocations, and to omit the RELRO program
> header (which requires a certain section layout that we don't adhere
> to in the kernel). These are the defaults for current versions of
> ld.bfd.
>
> - Discard .eh_frame and .gnu.hash sections to avoid them from being
> emitted between .head.text and .text, screwing up the section layout.
>
> These changes only affect the ELF image, and produce the same binary
> image.
Thanks, I've queued this up on for-next/core.
> [0] b9dce7f1ba01 ("arm64: kernel: force ET_DYN ELF type for ...")
>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Peter Smith <peter.smith@linaro.org>
> Tested-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> This supersedes
>
> [RFT PATCH] arm64: relocatable: build the kernel as a proper shared library
> [RFT PATCH] arm64: add support for building the KASLR kernel with LLVM lld
Also, this ^^ is /really/ helpful :)
Thanks,
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2018-12-04 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 19:58 [PATCH] arm64: relocatable: fix inconsistencies in linker script and options Ard Biesheuvel
2018-12-04 14:17 ` Will Deacon [this message]
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=20181204141744.GA6269@arm.com \
--to=will.deacon@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=ndesaulniers@google.com \
--cc=peter.smith@linaro.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;
as well as URLs for NNTP newsgroup(s).