From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Arnd Bergmann <arnd@arndb.de>, 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, 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 <chleroy@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org
Subject: Re: [PATCH 1/7] x86/vdso: Respect COMPAT_32BIT_TIME
Date: Thu, 5 Mar 2026 10:24:42 +0100 [thread overview]
Message-ID: <20260305080950-ff43457b-0551-480f-916e-6c252e6a64af@linutronix.de> (raw)
In-Reply-To: <6909A81E-AE50-459C-9604-3EEAEFE3838E@zytor.com>
On Wed, Mar 04, 2026 at 10:30:34AM -0800, H. Peter Anvin wrote:
> On March 3, 2026 11:35:52 PM PST, "Thomas Weißschuh" <thomas.weissschuh@linutronix.de> wrote:
> >On Tue, Mar 03, 2026 at 10:11:52AM -0800, H. Peter Anvin wrote:
> >> On 2026-02-27 01:34, Thomas Weißschuh wrote:
> >> >>>
> >> >> The thing about gettimeofday() and time() is that they don't have
> >> >> a 64-bit version and libc implementations are expected to call
> >> >> clock_gettime() instead. The result was that there was never a
> >> >> patch to turn the off either.
> >> >
> >> > gettimeofday() is currently the only way to get the timezone of the kernel.
> >> > But I guess this is a legacy thing anyways. If you say we should drop it,
> >> > let's drop it.
> >> >
> >>
> >> The time zone in the kernel has never worked anyway, as it would require the
> >> kernel to contain at least the forward portion of the zoneinfo/tzdata table in
> >> order to actually work correctly. The only plausible use of it would be for
> >> local time-based filesystems like FAT, but I don't think we bother.
> >
> >sys_tz is currently used by a bunch of drivers and filesystems (including FAT).
> >It is also used when writing to the RTC.
> >
> >> A bigger question is whether or not we should omit these from the vDSO
> >> completely (potentially causing link failures) or replace them with stubs
> >> returning -ENOSYS.
> >
> >I am a bit confused here. You mention 'link failures' and in another mail
> >'weak references as fallback'. Both are things that happen during linking
> >('link failures' could also be interpreted as failures during loading).
> >Somewhere else someone also mentioned the vDSO to be 'linkable'.
> >But as far as I understand, only libc interprets the vDSO, it completely
> >bypasses both the linker and the loader. And libc already does graceful
> >fallbacks to the regular systemcalls if the vDSO is missing completely or
> >lacks one of the functions, as both cases may happen on normal systems.
> >
> >What am I missing?
> Weak references would be a way to work around the link failures.
I am still not sure where "the link failures" should be coming from.
The only sense I can make out of it, is if somebody manually and directly links
to vdso.so. Like in the following example:
$ cat test.c
#include <stdio.h>
#include <linux/time.h>
int __vdso_clock_gettime(__kernel_clockid_t clock, struct __kernel_timespec *ts);
int main(void)
{
struct __kernel_timespec ts;
int ret;
printf("__vdso_clock_gettime=%p\n", __vdso_clock_gettime);
ret = __vdso_clock_gettime(CLOCK_REALTIME, &ts);
printf("ret=%d\n", ret);
}
$ gcc test.c /lib/modules/$(uname -r)/vdso/vdso64.so
$ ./a.out
__vdso_clock_gettime=0x7ff6ba2eeb80
ret=0
This actually works on glibc (not on musl). But it is highly non-standard and
relies on multiple implementation details. Furthermore it can fail to run on
systems without a vDSO, as mentioned before.
Is this the usage pattern you have in mind?
Do you know of anybody doing things this way?
(...)
Thomas
next prev parent reply other threads:[~2026-03-05 9:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 6:57 [PATCH 0/7] vDSO: Respect COMPAT_32BIT_TIME Thomas Weißschuh
2026-02-27 6:57 ` [PATCH 1/7] x86/vdso: " Thomas Weißschuh
2026-02-27 8:51 ` Arnd Bergmann
2026-02-27 8:58 ` Arnd Bergmann
2026-02-27 9:34 ` Thomas Weißschuh
2026-03-03 18:11 ` H. Peter Anvin
2026-03-03 20:50 ` Arnd Bergmann
2026-03-03 21:00 ` H. Peter Anvin
2026-03-03 21:27 ` Arnd Bergmann
2026-03-03 21:36 ` H. Peter Anvin
2026-04-10 7:24 ` Thomas Weißschuh
2026-04-13 15:59 ` Arnd Bergmann
2026-04-13 16:13 ` Thomas Weißschuh
2026-04-13 16:57 ` Arnd Bergmann
2026-04-14 10:16 ` Thomas Weißschuh
2026-03-04 7:35 ` Thomas Weißschuh
2026-03-04 18:30 ` H. Peter Anvin
2026-03-05 9:24 ` Thomas Weißschuh [this message]
2026-03-05 23:57 ` H. Peter Anvin
2026-03-06 9:42 ` Thomas Weißschuh
2026-03-06 20:52 ` H. Peter Anvin
2026-02-27 6:57 ` [PATCH 2/7] ARM: VDSO: " Thomas Weißschuh
2026-02-27 6:57 ` [PATCH 3/7] arm64: vdso32: " Thomas Weißschuh
2026-02-27 6:57 ` [PATCH 4/7] powerpc/vdso: " Thomas Weißschuh
2026-02-27 6:57 ` [PATCH 5/7] MIPS: VDSO: Drop kconfig MIPS_CLOCK_VSYSCALL Thomas Weißschuh
2026-02-27 8:46 ` Arnd Bergmann
2026-02-27 9:31 ` Thomas Weißschuh
2026-02-27 10:03 ` Arnd Bergmann
2026-02-27 10:17 ` Thomas Weißschuh
2026-02-27 6:57 ` [PATCH 6/7] MIPS: VDSO: Respect COMPAT_32BIT_TIME Thomas Weißschuh
2026-02-27 6:57 ` [PATCH 7/7] vdso/gettimeofday: Verify COMPAT_32BIT_TIME interactions Thomas Weißschuh
2026-02-27 8:49 ` 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=20260305080950-ff43457b-0551-480f-916e-6c252e6a64af@linutronix.de \
--to=thomas.weissschuh@linutronix.de \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chleroy@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--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=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).