[PATCH v6 0/5] vdso: Keep the CLOCK_AUX base at full precision
From: Zhan Xusheng
Date: Wed Sep 30 2026 - 13:33:42 EST
v5 was dropped from tip timers/vdso over the 0-day build failures. Thomas
Weissschuh had already told me how to fix this on Sep 8 and I posted v5
without it; sorry for the wasted round.
lib/vdso/gettimeofday.c is built into the vDSO, where linux/bits.h is not
available, so the BUILD_BUG_ON() added by patch 5 referred to an undeclared
BITS_PER_TYPE(). The compiler then treats it as an implicit function call,
the comparison is no longer a constant expression, and the assert fires:
lib/vdso/gettimeofday.c:288:24: error: implicit declaration of function
'BITS_PER_TYPE'; did you mean 'BITS_PER_LONG'?
compiler_types.h:702:38: error: call to '__compiletime_assert_5' declared
with attribute error: BUILD_BUG_ON failed: clock >= BITS_PER_TYPE(msk)
New patch 4 moves BITS_PER_BYTE and BITS_PER_TYPE() to vdso/bits.h, as
Thomas suggested. linux/bits.h already includes vdso/bits.h and
vdso/datapage.h already pulls vdso/bits.h into the vDSO translation units,
so no include changes anywhere. tools/perf/check-headers.sh tracks both
headers, so the tools copies move in lockstep.
Changes since v5:
- New patch 4: move BITS_PER_BYTE and BITS_PER_TYPE() to vdso/bits.h
(Thomas Weissschuh, kernel test robot)
- Patches 1-3 and 5 are v5 unmodified; patch 5 picked up the robot tags
Reproduced the failure on v5 with "make ARCH=powerpc LLVM=1
arch/powerpc/kernel/vdso/": two errors, at gettimeofday.c:288 and :442.
With patch 4 the same build is clean. Built all five commits in order on
powerpc, each clean, so a bisect does not land on a broken tree this time.
x86-64 and arm64 vDSO plus lib/ build clean, check-headers.sh is quiet, and
checkpatch --strict reports 0/0/0 on all five.
v5: https://patch.msgid.link/20260916023252.418473-1-zhanxusheng@xxxxxxxxxx
Zhan Xusheng (5):
vdso/math64: Use OPTIMIZER_HIDE_VAR() in __iter_div_u64_rem()
vdso/math64: Add and use __iter_div64_u64_rem()
vdso/vsyscall: Keep the CLOCK_AUX base scaled
vdso: Move BITS_PER_BYTE and BITS_PER_TYPE() to vdso/bits.h
vdso/gettimeofday: Assert that the clockid fits into the u32 bitmask
include/linux/bits.h | 2 --
include/vdso/bits.h | 2 ++
include/vdso/math64.h | 31 ++++++++++++++++++++++++++-----
kernel/time/vsyscall.c | 26 ++++++++++----------------
lib/vdso/gettimeofday.c | 2 ++
tools/include/linux/bits.h | 2 --
tools/include/vdso/bits.h | 2 ++
7 files changed, 42 insertions(+), 25 deletions(-)
base-commit: 9b87fdc9af2fbfcdb5c24a64139685ef80f6573f
--
2.43.0