From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Andy Lutomirski <luto@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
John Stultz <jstultz@google.com>,
Stephen Boyd <sboyd@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>
Cc: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org,
"Arnd Bergmann" <arnd@arndb.de>,
linux-api@vger.kernel.org, sparclinux@vger.kernel.org
Subject: [PATCH v2 2/9] vdso/gettimeofday: Validate system call existence for time() and gettimeofday()
Date: Tue, 30 Jun 2026 09:38:31 +0200 [thread overview]
Message-ID: <20260630-vdso-compat_32bit_time-v2-2-520d194640dd@linutronix.de> (raw)
In-Reply-To: <20260630-vdso-compat_32bit_time-v2-0-520d194640dd@linutronix.de>
Not all architectures have the system calls for time() and
gettimeofday(). When the system call is missing, the vDSO function
should also not be present.
Validate that.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
lib/vdso/gettimeofday.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index e0f289d3d110..b8c1fc85eb74 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -12,6 +12,8 @@
#include <vdso/time32.h>
#include <vdso/time64.h>
+#include <uapi/linux/unistd.h>
+
/*
* The generic vDSO implementation requires that gettimeofday.h
* provides:
@@ -348,6 +350,10 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
{
const struct vdso_clock *vc = vd->clock_data;
+#ifndef __NR_gettimeofday
+ BUILD_BUG();
+#endif
+
if (likely(tv != NULL)) {
struct __kernel_timespec ts;
@@ -382,6 +388,10 @@ __cvdso_time_data(const struct vdso_time_data *vd, __kernel_old_time_t *time)
const struct vdso_clock *vc = vd->clock_data;
__kernel_old_time_t t;
+#ifndef __NR_time
+ BUILD_BUG();
+#endif
+
if (vdso_is_timens_clock(vc)) {
vd = vdso_timens_data(vd);
vc = vd->clock_data;
--
2.55.0
next prev parent reply other threads:[~2026-06-30 7:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 7:38 [PATCH v2 0/9] vDSO: Respect COMPAT_32BIT_TIME Thomas Weißschuh
2026-06-30 7:38 ` [PATCH v2 1/9] time: Respect COMPAT_32BIT_TIME for old time type functions Thomas Weißschuh
2026-06-30 13:00 ` Arnd Bergmann
2026-07-01 8:40 ` Thomas Weißschuh
2026-07-01 13:11 ` Arnd Bergmann
2026-06-30 7:38 ` Thomas Weißschuh [this message]
2026-07-01 7:47 ` [PATCH v2 2/9] vdso/gettimeofday: Validate system call existence for time() and gettimeofday() Philippe Mathieu-Daudé
2026-06-30 7:38 ` [PATCH v2 3/9] x86/vdso: Respect COMPAT_32BIT_TIME Thomas Weißschuh
2026-06-30 7:38 ` [PATCH v2 4/9] arm64: vdso32: " Thomas Weißschuh
2026-07-01 7:49 ` Philippe Mathieu-Daudé
2026-06-30 7:38 ` [PATCH v2 5/9] ARM: VDSO: " Thomas Weißschuh
2026-07-01 7:49 ` Philippe Mathieu-Daudé
2026-06-30 7:38 ` [PATCH v2 6/9] powerpc/vdso: " Thomas Weißschuh
2026-06-30 7:38 ` [PATCH v2 7/9] MIPS: VDSO: " Thomas Weißschuh
2026-06-30 7:38 ` [PATCH v2 8/9] sparc: vdso: " Thomas Weißschuh
2026-07-01 7:50 ` Philippe Mathieu-Daudé
2026-06-30 7:38 ` [PATCH v2 9/9] vdso/gettimeofday: Verify COMPAT_32BIT_TIME interactions Thomas Weißschuh
2026-07-01 7:51 ` Philippe Mathieu-Daudé
2026-06-30 13:16 ` [PATCH v2 0/9] vDSO: Respect COMPAT_32BIT_TIME Arnd Bergmann
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=20260630-vdso-compat_32bit_time-v2-2-520d194640dd@linutronix.de \
--to=thomas.weissschuh@linutronix.de \
--cc=andreas@gaisler.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chleroy@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=hpa@zytor.com \
--cc=jstultz@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luto@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=sboyd@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/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