Thread (53 messages) 53 messages, 11 authors, 2020-12-02

Re: [PATCH] ARM: Link with '-z norelro'

From: Nick Desaulniers <hidden>
Date: 2020-12-02 23:07:17

Does this need to get submitted to
https://www.armlinux.org.uk/developer/patches/section.php?section=0
since `-z norelro` will produce warnings in ld.bfd for architectures
that don't support that (the results of the thread on adding it
globally)?

On Wed, Nov 11, 2020 at 6:52 PM Nathan Chancellor
[off-list ref] wrote:
On Tue, Nov 10, 2020 at 10:49:32AM -0800, Nick Desaulniers wrote:
quoted
On Mon, Nov 9, 2020 at 6:05 PM Nick Desaulniers [off-list ref] wrote:
quoted
On Mon, Nov 9, 2020 at 5:56 PM Nathan Chancellor
[off-list ref] wrote:
quoted
When linking a multi_v7_defconfig + CONFIG_KASAN=y kernel with
LD=ld.lld, the following error occurs:

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 zImage
ld.lld: error: section: .exit.data is not contiguous with other relro sections

LLD defaults to '-z relro', which is unneeded for the kernel because
program headers are not used nor is there any position independent code
generation or linking for ARM. Add '-z norelro' to LDFLAGS_vmlinux to
avoid this error.

Link: https://github.com/ClangBuiltLinux/linux/issues/1189
Signed-off-by: Nathan Chancellor <redacted>
Reviewed-by: Nick Desaulniers <redacted>
Tested-by: Nick Desaulniers <redacted>

Thanks for the patch!
See also: https://lore.kernel.org/linux-arm-kernel/20201016175339.2429280-1-ndesaulniers@google.com/ (local)
where we just did the same thing for aarch64.
I was thinking more about this last night.  If we're going to be
playing whack-a-mole for each architecture with this, would it be
worthwhile for us to raise this up to the top level Makefile?
Sure, I can send a patch along tomorrow that adds '-z norelro' to
LDFLAGS_vmlinux in the top level Makefile.

Cheers,
Nathan


-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help