Skip to content

Commit 00a9481

Browse files
wildea01Mark Salyzyn
authored and
Mark Salyzyn
committed
UPSTREAM: arm64: vdso: work-around broken ELF toolchains in Makefile
(cherry pick from commit 6f1a6ae87c0c60d7c462ef8fd071f291aa7a9abb) 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> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Bug: 20045882 Bug: 19198045 Change-Id: Ifa5152a7894978ea2fc3a4c2ed99ed07106e12f8
1 parent d39e205 commit 00a9481

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/kernel/vdso/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin
1515
ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
1616
$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
1717

18+
# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
19+
# down to collect2, resulting in silent corruption of the vDSO image.
20+
ccflags-y += -Wl,-shared
21+
1822
obj-y += vdso.o
1923
extra-y += vdso.lds vdso-offsets.h
2024
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)

0 commit comments

Comments
 (0)