Skip to content

Commit 625412c

Browse files
nickdesaulnierswilldeacon
authored andcommitted
arm64: vdso32: add CONFIG_THUMB2_COMPAT_VDSO
Allow the compat vdso (32b) to be compiled as either THUMB2 (default) or ARM. For THUMB2, the register r7 is reserved for the frame pointer, but code in arch/arm64/include/asm/vdso/compat_gettimeofday.h uses r7. Explicitly set -fomit-frame-pointer, since unwinding through interworked THUMB2 and ARM is unreliable anyways. See also how CONFIG_UNWINDER_FRAME_POINTER cannot be selected for CONFIG_THUMB2_KERNEL for ARCH=arm. This also helps toolchains that differ in their implicit value if the choice of -f{no-}omit-frame-pointer is left unspecified, to not error on the use of r7. 2019 Q4 ARM AAPCS seeks to standardize the use of r11 as the reserved frame pointer register, but no production compiler that can compile the Linux kernel currently implements this. We're actively discussing such a transition with ARM toolchain developers currently. Reported-by: Luis Lozano <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> Tested-by: Manoj Gupta <[email protected]> Acked-by: Catalin Marinas <[email protected]> Cc: Stephen Boyd <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Dave Martin <[email protected]> Link: https://static.docs.arm.com/ihi0042/i/aapcs32.pdf Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1084372 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 961abd7 commit 625412c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

arch/arm64/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,14 @@ config COMPAT_VDSO
12971297
You must have a 32-bit build of glibc 2.22 or later for programs
12981298
to seamlessly take advantage of this.
12991299

1300+
config THUMB2_COMPAT_VDSO
1301+
bool "Compile the 32-bit vDSO for Thumb-2 mode" if EXPERT
1302+
depends on COMPAT_VDSO
1303+
default y
1304+
help
1305+
Compile the compat vDSO with '-mthumb -fomit-frame-pointer' if y,
1306+
otherwise with '-marm'.
1307+
13001308
menuconfig ARMV8_DEPRECATED
13011309
bool "Emulate deprecated/obsolete ARMv8 instructions"
13021310
depends on SYSCTL

arch/arm64/kernel/vdso32/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ VDSO_CFLAGS += -D__uint128_t='void*'
105105
VDSO_CFLAGS += $(call cc32-disable-warning,shift-count-overflow)
106106
VDSO_CFLAGS += -Wno-int-to-pointer-cast
107107

108+
# Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is
109+
# unreliable.
110+
ifeq ($(CONFIG_THUMB2_COMPAT_VDSO), y)
111+
VDSO_CFLAGS += -mthumb -fomit-frame-pointer
112+
else
113+
VDSO_CFLAGS += -marm
114+
endif
115+
108116
VDSO_AFLAGS := $(VDSO_CAFLAGS)
109117
VDSO_AFLAGS += -D__ASSEMBLY__
110118

0 commit comments

Comments
 (0)