linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nathan Lynch <nathan_lynch@mentor.com>,
	open list <linux-kernel@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Alexios Zavras <alexios.zavras@intel.com>,
	opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Enrico Weigelt <info@metux.net>
Subject: [PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional()
Date: Thu, 16 Jan 2020 15:57:28 -0800	[thread overview]
Message-ID: <20200116235731.22395-1-f.fainelli@gmail.com> (raw)

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

             reply	other threads:[~2020-01-16 23:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 23:57 Florian Fainelli [this message]
2020-01-28 19:26 ` [PATCH] ARM: VDSO: Match ARMv8 timer in cntvct_functional() Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200116235731.22395-1-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=alexios.zavras@intel.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=info@metux.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan_lynch@mentor.com \
    --cc=opendmb@gmail.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=tglx@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).