linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional()
@ 2020-01-16 23:57 Florian Fainelli
  2020-01-28 19:26 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2020-01-16 23:57 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Florian Fainelli, Greg Kroah-Hartman, Nathan Lynch, open list,
	Geert Uytterhoeven, Alexios Zavras, opendmb,
	bcm-kernel-feedback-list, Russell King, Thomas Gleixner,
	Vincenzo Frascino, Enrico Weigelt

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

out:
        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;
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional()
  2020-01-16 23:57 [PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional() Florian Fainelli
@ 2020-01-28 19:26 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2020-01-28 19:26 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: opendmb, Greg Kroah-Hartman, Nathan Lynch, open list,
	Geert Uytterhoeven, Alexios Zavras, bcm-kernel-feedback-list,
	Russell King, Thomas Gleixner, Vincenzo Frascino, Enrico Weigelt



On 1/16/2020 3:57 PM, Florian Fainelli wrote:
> 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@gmail.com>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-28 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 23:57 [PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional() Florian Fainelli
2020-01-28 19:26 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).