* [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile
@ 2015-06-19 12:56 Will Deacon
2015-06-19 14:10 ` Catalin Marinas
2015-06-19 14:47 ` Nathan Lynch
0 siblings, 2 replies; 4+ messages in thread
From: Will Deacon @ 2015-06-19 12:56 UTC (permalink / raw)
To: linux-arm-kernel
When building the kernel with a bare-metal (ELF) toolchain, the -shared
option may not be passed down to collect2, resulting in silent corruption
of the vDSO image (in particular, the DYNAMIC section is omitted).
The effect of this corruption is that the dynamic linker fails to find
the vDSO symbols and libc is instead used for the syscalls that we
intended to optimise (e.g. gettimeofday). Functionally, there is no
issue as the sigreturn trampoline is still intact and located by the
kernel.
This patch fixes the problem by explicitly passing -shared to the linker
when building the vDSO.
Cc: <stable@vger.kernel.org>
Reported-by: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Reported-by: James Greenlaigh <james.greenhalgh@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
arch/arm64/kernel/vdso/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index ff3bddea482d..f6fe17d88da5 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
+# down to collect2, resulting in silent corruption of the vDSO image.
+ccflags-y += -Wl,-shared
+
obj-y += vdso.o
extra-y += vdso.lds vdso-offsets.h
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile
2015-06-19 12:56 [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile Will Deacon
@ 2015-06-19 14:10 ` Catalin Marinas
2015-06-19 14:47 ` Nathan Lynch
1 sibling, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2015-06-19 14:10 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 19, 2015 at 01:56:33PM +0100, Will Deacon wrote:
> When building the kernel with a bare-metal (ELF) toolchain, the -shared
> option may not be passed down to collect2, resulting in silent corruption
> of the vDSO image (in particular, the DYNAMIC section is omitted).
>
> The effect of this corruption is that the dynamic linker fails to find
> the vDSO symbols and libc is instead used for the syscalls that we
> intended to optimise (e.g. gettimeofday). Functionally, there is no
> issue as the sigreturn trampoline is still intact and located by the
> kernel.
>
> This patch fixes the problem by explicitly passing -shared to the linker
> when building the vDSO.
>
> Cc: <stable@vger.kernel.org>
> Reported-by: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
> Reported-by: James Greenlaigh <james.greenhalgh@arm.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
Queued for 4.2. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile
2015-06-19 12:56 [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile Will Deacon
2015-06-19 14:10 ` Catalin Marinas
@ 2015-06-19 14:47 ` Nathan Lynch
2015-06-19 14:55 ` Will Deacon
1 sibling, 1 reply; 4+ messages in thread
From: Nathan Lynch @ 2015-06-19 14:47 UTC (permalink / raw)
To: linux-arm-kernel
On 06/19/2015 07:56 AM, Will Deacon wrote:
> When building the kernel with a bare-metal (ELF) toolchain, the -shared
> option may not be passed down to collect2, resulting in silent corruption
> of the vDSO image (in particular, the DYNAMIC section is omitted).
I checked arch/arm with
arm-none-eabi-gcc (Fedora 4.9.2-3.fc21) 4.9.2
and it doesn't seem to be affected. Do you know whether the toolchain
issue is aarch64-specific?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile
2015-06-19 14:47 ` Nathan Lynch
@ 2015-06-19 14:55 ` Will Deacon
0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2015-06-19 14:55 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 19, 2015 at 03:47:46PM +0100, Nathan Lynch wrote:
> On 06/19/2015 07:56 AM, Will Deacon wrote:
> > When building the kernel with a bare-metal (ELF) toolchain, the -shared
> > option may not be passed down to collect2, resulting in silent corruption
> > of the vDSO image (in particular, the DYNAMIC section is omitted).
>
> I checked arch/arm with
>
> arm-none-eabi-gcc (Fedora 4.9.2-3.fc21) 4.9.2
>
> and it doesn't seem to be affected. Do you know whether the toolchain
> issue is aarch64-specific?
I don't know for sure, but it seems to affect all AArch64 toolchains so
from your observations, arch/arm/ should be ok.
Will
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-19 14:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19 12:56 [PATCH] arm64: vdso: work-around broken ELF toolchains in Makefile Will Deacon
2015-06-19 14:10 ` Catalin Marinas
2015-06-19 14:47 ` Nathan Lynch
2015-06-19 14:55 ` Will Deacon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.