Skip to contentSkip to conversation

ARM: VDSO: Match ARMv8 timer in cntvct_functional()

PATCH In review Florian Fainelli 1 participant 2 messages Jan 16, 2020 – Jan 28, 2020 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: VDSO: Match ARMv8 timer in cntvct_functional()

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")

---
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");
        }

out:

        return dlclose(h);
}
 arch/arm/kernel/vdso.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/kernel/vdso.c +2 -0
index c89ac1b9d28b..e0330a25e1c6 100644
@@ -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;
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · Florian Fainelli

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")

Submitted:
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=8957/1

Signature · 1 line
Florian