[PATCH 1/7] x86/vdso: Respect COMPAT_32BIT_TIME
H. Peter Anvin
hpa at zytor.com
Thu Mar 5 05:30:34 AEDT 2026
On March 3, 2026 11:35:52 PM PST, "Thomas Weißschuh" <thomas.weissschuh at 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?
>
>
>Thomas
Weak references would be a way to work around the link failures.
At least in practice the RTC timezone should be managed from user space.
As I said, managing time zone information in the kernel correctly (beyond "right now", which can be dealt with by an external daemon on discontinuities; maybe systemd does that) would require far more than settimeofday() provides.
Downloading a binary zoneinfo (TZif2) blob into the kernel certainly isn't out of the question and would solve this issue correctly once and for all; a single zoneinfo blob is (currently) slightly below 4K in size, and the stock interpreter is about 14K, which, even if we can't strip out any additional functionality we don't need, is more or less a drop in the bucket these days.
-hpa
More information about the Linuxppc-dev
mailing list