[PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional()

Florian Fainelli f.fainelli at gmail.com
Thu Jan 16 15:57:28 PST 2020

It is possible for a system with an ARMv8 timer to run a 32-bit kernel.
When this happens we will unconditionally have the vDSO code remove the
__vdso_gettimeofday and __vdso_clock_gettime symbols because
cntvct_functional() returns false since it does not match that
compatibility string.

Fixes: ecf99a439105 ("ARM: 8331/1: VDSO initialization, mapping, and synchronization")
Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
Hi all,

This was found by one of our customers and the following test program
below can be used to find whether the "bug" is fixed or not.

The Fixes tag is much after the arm_arch_timer.c gained support for the
ARMv8 timers, which is why it is being referenced.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dlfcn.h>

#define ARM_LDSO_NAME   "linux-vdso.so.1"

int main(int argc, char **argv)
        void *h, *sym[2];

        h = dlopen(ARM_LDSO_NAME, RTLD_NOW);
        if (!h) {
                fprintf(stderr, "failed top dlopen\n");
                return 1;

        sym[0] = dlsym(h, "__vdso_gettimeofday");
        sym[1] = dlsym(h, "__vdso_clock_gettime");
        if (!sym[0] && !sym[1]) {
                fprintf(stderr, "Kernel does not provide symbols, check DT!\n");
        } else {
                fprintf(stdout, "Kernel provides vDSO symbols!\n");

        return dlclose(h);

 arch/arm/kernel/vdso.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c
index c89ac1b9d28b..e0330a25e1c6 100644
--- a/arch/arm/kernel/vdso.c
+++ b/arch/arm/kernel/vdso.c
@@ -94,6 +94,8 @@ static bool __init cntvct_functional(void)
 	 * this.
 	np = of_find_compatible_node(NULL, NULL, "arm,armv7-timer");
+	if (!np)
+		np = of_find_compatible_node(NULL, NULL, "arm,armv8-timer");
 	if (!np)
 		goto out_put;

More information about the linux-arm-kernel mailing list