We have a class of errata (grouped under the ARM64_WORKAROUND_1418040 banner) that force the trapping of counter access from 32bit EL0.
We would normally disable the whole vdso for such defect, except that it would disable it for 64bit userspace as well, which is a shame.
Instead, add a new vdso_clock_mode, which signals that the vdso isn't usable for compat tasks. This gets checked in the new vdso_clocksource_ok() helper, now provided for the 32bit vdso.
Cc: stable@vger.kernel.org Acked-by: Mark Rutland mark.rutland@arm.com Signed-off-by: Marc Zyngier maz@kernel.org --- arch/arm64/include/asm/vdso/clocksource.h | 7 +++++-- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/vdso/clocksource.h b/arch/arm64/include/asm/vdso/clocksource.h index df6ea65c1dec..b054d9febfb5 100644 --- a/arch/arm64/include/asm/vdso/clocksource.h +++ b/arch/arm64/include/asm/vdso/clocksource.h @@ -2,7 +2,10 @@ #ifndef __ASM_VDSOCLOCKSOURCE_H #define __ASM_VDSOCLOCKSOURCE_H
-#define VDSO_ARCH_CLOCKMODES \ - VDSO_CLOCKMODE_ARCHTIMER +#define VDSO_ARCH_CLOCKMODES \ + /* vdso clocksource for both 32 and 64bit tasks */ \ + VDSO_CLOCKMODE_ARCHTIMER, \ + /* vdso clocksource for 64bit tasks only */ \ + VDSO_CLOCKMODE_ARCHTIMER_NOCOMPAT
#endif diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h index b6907ae78e53..9a625e8947ff 100644 --- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h +++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h @@ -111,7 +111,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) * update. Return something. Core will do another round and then * see the mode change and fallback to the syscall. */ - if (clock_mode == VDSO_CLOCKMODE_NONE) + if (clock_mode != VDSO_CLOCKMODE_ARCHTIMER) return 0;
/* @@ -152,6 +152,12 @@ static __always_inline const struct vdso_data *__arch_get_vdso_data(void) return ret; }
+static inline bool vdso_clocksource_ok(const struct vdso_data *vd) +{ + return vd->clock_mode == VDSO_CLOCKMODE_ARCHTIMER; +} +#define vdso_clocksource_ok vdso_clocksource_ok + #endif /* !__ASSEMBLY__ */
#endif /* __ASM_VDSO_GETTIMEOFDAY_H */
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.7.7, v5.4.50, v4.19.131, v4.14.187, v4.9.229, v4.4.229.
v5.7.7: Build OK! v5.4.50: Failed to apply! Possible dependencies: 04bb96427d4ee ("ARM: 8947/1: Fix __arch_get_hw_counter() access to CNTVCT") 20e2fc42312f9 ("ARM: 8930/1: Add support for generic vDSO") 31fdcac07f679 ("arm64: Introduce asm/vdso/clocksource.h") 5e3c6a312a094 ("ARM/arm64: vdso: Use common vdso clock mode storage")
v4.19.131: Failed to apply! Possible dependencies: 31fdcac07f679 ("arm64: Introduce asm/vdso/clocksource.h") 5e3c6a312a094 ("ARM/arm64: vdso: Use common vdso clock mode storage") 6bf752daca07c ("powerpc: implement CONFIG_DEBUG_VIRTUAL") 942fa985e9f16 ("32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option") aef0f78e7460c ("binfmt_flat: add a ARCH_HAS_BINFMT_FLAT option") bdd15a288492f ("binfmt_flat: replace flat_argvp_envp_on_stack with a Kconfig variable") c32e64e852f3f ("csky: Build infrastructure") e0a9317d90042 ("hexagon: use generic dma_noncoherent_ops") ea6a37373f9ac ("MIPS: Avoid FP ELF checks when CONFIG_MIPS_FP_SUPPORT=n") f406f222d4b21 ("hexagon: implement the sync_sg_for_device DMA operation")
v4.14.187: Failed to apply! Possible dependencies: 104daea149c45 ("kconfig: reference environment variables directly and remove 'option env='") 18492685e479f ("kconfig: use yylineno option instead of manual lineno increments") 21c54b7747447 ("kconfig: show compiler version text in the top comment") 31fdcac07f679 ("arm64: Introduce asm/vdso/clocksource.h") 32a94b8b0c3e5 ("kconfig: remove duplicated file name and lineno of recursive inclusion") 379a8eb8eb1a5 ("kconfig: detect recursive inclusion earlier") 5ae6fcc4bb82b ("kconfig: fix line number in recursive inclusion error message") 5e3c6a312a094 ("ARM/arm64: vdso: Use common vdso clock mode storage") 79b05c1f31e2e ("um: stop abusing KBUILD_KCONFIG") 7f5c1ea3b707f ("c6x: use generic dma_noncoherent_ops") 87a4c375995ed ("kconfig: include kernel/Kconfig.preempt from init/Kconfig") 942fa985e9f16 ("32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option") 9e3e10c725360 ("kconfig: send error messages to stderr") c32e64e852f3f ("csky: Build infrastructure") cd81fc82b93fa ("kconfig: add xstrdup() helper") d717f24d8c680 ("kconfig: add xrealloc() helper") e0a9317d90042 ("hexagon: use generic dma_noncoherent_ops") e2c75e7667c73 ("kconfig: tests: test if recursive inclusion is detected") e71ea3badae55 ("nds32: Build infrastructure") f163977d21a2b ("um: cleanup Kconfig files") fbe934d69eb7e ("RISC-V: Build Infrastructure")
v4.9.229: Failed to apply! Possible dependencies: 2fbadc3002c5f ("arm/arm64: xen: Move shared architecture headers to include/xen/arm") 31fdcac07f679 ("arm64: Introduce asm/vdso/clocksource.h") 5299709d0a873 ("treewide: Constify most dma_map_ops structures") 5e3c6a312a094 ("ARM/arm64: vdso: Use common vdso clock mode storage") 7f5c1ea3b707f ("c6x: use generic dma_noncoherent_ops") 942fa985e9f16 ("32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option") eb17726b00b32 ("m32r: add simple dma")
v4.4.229: Failed to apply! Possible dependencies: 0cb0786bac159 ("ARM64: PCI: Support ACPI-based PCI host controller") 1a4f93f7112fd ("PCI: Factor DT-specific pci_bus_find_domain_nr() code out") 1bd37a6835bef ("iommu/arm-smmu: Workaround for ThunderX erratum #27704") 1d8f51d41fc71 ("arm/arm64: arch_timer: Use archdata to indicate vdso suitability") 21266be9ed542 ("arch: consolidate CONFIG_STRICT_DEVM in lib/Kconfig.debug") 2ab51ddeca2fc ("ARM64: PCI: Add acpi_pci_bus_find_domain_nr()") 31fdcac07f679 ("arm64: Introduce asm/vdso/clocksource.h") 46fd5c6b30594 ("clocksource/drivers/arm_arch_timer: Control the evtstrm via the cmdline") 4e3e9b6997b24 ("iommu/arm-smmu: Add support for 16 bit VMID") 5e3c6a312a094 ("ARM/arm64: vdso: Use common vdso clock mode storage") 75df1386557c2 ("iommu/arm-smmu: Invalidate TLBs properly") 942fa985e9f16 ("32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option") 9c7cb891ecfea ("PCI: Refactor pci_bus_assign_domain_nr() for CONFIG_PCI_DOMAINS_GENERIC") cd5f22d7967f6 ("arm64: arch_timer: simplify accessors") f6dc1576cd517 ("arm64: arch_timer: Work around QorIQ Erratum A-008585")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
linux-stable-mirror@lists.linaro.org