[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.21.2004110032550.851719@eddie.linux-mips.org>
Date: Sat, 11 Apr 2020 00:40:42 +0100 (BST)
From: "Maciej W. Rozycki" <macro@...ux-mips.org>
To: Kees Cook <keescook@...omium.org>
cc: Jiaxun Yang <jiaxun.yang@...goat.com>, linux-mips@...r.kernel.org,
Fangrui Song <maskray@...gle.com>,
Nathan Chancellor <natechancellor@...il.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Paul Burton <paulburton@...nel.org>,
Borislav Petkov <bp@...e.de>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH v3] MIPS: Truncate link address into 32bit for 32bit
kernel
On Fri, 10 Apr 2020, Kees Cook wrote:
> > diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
> > index d6e97df51cfb..0178f7085317 100644
> > --- a/arch/mips/kernel/Makefile
> > +++ b/arch/mips/kernel/Makefile
> > @@ -112,4 +112,13 @@ obj-$(CONFIG_MIPS_CPC) += mips-cpc.o
> > obj-$(CONFIG_CPU_PM) += pm.o
> > obj-$(CONFIG_MIPS_CPS_PM) += pm-cps.o
> >
> > -CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
> > +# When linking a 32-bit executable the LLVM linker cannot cope with a
> > +# 32-bit load address that has been sign-extended to 64 bits. Simply
> > +# remove the upper 32 bits then, as it is safe to do so with other
> > +# linkers.
> > +ifdef CONFIG_64BIT
> > + load-ld = $(VMLINUX_LOAD_ADDRESS)
> > +else
> > + load-ld = $(shell $(objtree)/arch/mips/tools/truncate32 $(VMLINUX_LOAD_ADDRESS))
>
> This is major overkill. Just use the Makefile's builtin text
> manipulation:
>
> load-ld = $(subst 0xffffffff,0x,$(VMLINUX_LOAD_ADDRESS))
This looks like the best approach to me, thank you for the hint! And we
only ever want to strip 0xffffffff anyway. (I forgot about this function
of `make', doh!)
Maciej
Powered by blists - more mailing lists