[RFC PATCH 3/5] vdso: Switch the sanctioned headers to vdso/types.h

From: Fang Xieyan

Date: Tue Dec 01 2026 - 05:24:40 EST


Now that <vdso/types.h> provides the sanitized UAPI type subset and the
x86 side no longer carries redundant includes that would clash, convert
the sanctioned include/vdso headers to take their types from it:

datapage.h: <linux/types.h> -> <vdso/types.h>, drop <uapi/linux/time.h>
gettime.h: <linux/types.h> -> <vdso/types.h>
getrandom.h: <linux/types.h> -> <vdso/types.h>
time.h: <uapi/linux/types.h> -> <vdso/types.h>
auxclock.h: <uapi/linux/time.h>, <uapi/linux/types.h> -> <vdso/types.h>

This removes the direct dependency of the sanctioned headers on
kernel-internal and UAPI type headers, so vDSO code compiled against
them no longer reaches include/asm-generic/bitsperlong.h through the
type headers.

Note the vDSO build still reaches <linux/types.h> indirectly through
unrelated kernel-header paths (e.g. asm/msr.h -> linux/percpu.h ->
linux/time64.h on x86); breaking those remaining chains is left for
follow-up work.

Signed-off-by: Fang Xieyan <fangxy@xxxxxxxxxxxx>
---
Build-tested at this commit: x86_64 defconfig (CONFIG_IA32_EMULATION=y,
CONFIG_X86_X32_ABI=y) builds bzImage with 0 errors producing
vdso32.so.dbg, vdso64.so.dbg and vdsox32.so.dbg, and the arm64
defconfig cross-build (aarch64-linux-gnu-gcc) builds Image with 0
errors producing vdso.so/vdso.so.dbg. arm, riscv, loongarch and s390
also build cleanly with the full series; the mips and powerpc vDSO
objects build cleanly too (their full-tree failures reproduce
identically on the unpatched baseline with the same clang toolchain
limitations).

A compiler -H trace confirms include/vdso/types.h is self-contained and
that the sanctioned headers no longer include <linux/types.h> or the
UAPI time headers directly. The remaining linux/types.h / asm-generic/
bitsperlong.h inclusions reach the vDSO build through unrelated
kernel-header paths (e.g. asm/msr.h -> linux/percpu.h -> linux/time64.h)
and are left for follow-up work, as noted above.

Series based on v7.4-rc5 (fe6ff8d5d675). The per-commit build results
above were collected on v7.4-rc4; none of the fifteen files this series
touches changed between the two tags, and rebuilding the x86 vDSO on
this base yields byte-identical vdso64, vdsox32 and vdso32 objects.

include/vdso/auxclock.h | 3 +--
include/vdso/datapage.h | 3 +--
include/vdso/getrandom.h | 2 +-
include/vdso/gettime.h | 2 +-
include/vdso/time.h | 2 +-
5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/vdso/auxclock.h b/include/vdso/auxclock.h
index 6d6e74cbc400..82b675c207dd 100644
--- a/include/vdso/auxclock.h
+++ b/include/vdso/auxclock.h
@@ -2,8 +2,7 @@
#ifndef _VDSO_AUXCLOCK_H
#define _VDSO_AUXCLOCK_H

-#include <uapi/linux/time.h>
-#include <uapi/linux/types.h>
+#include <vdso/types.h>

static __always_inline u64 aux_clock_resolution_ns(void)
{
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 09897f76ae07..286f625659b3 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -4,10 +4,9 @@

#ifndef __ASSEMBLER__

-#include <linux/types.h>
+#include <vdso/types.h>

#include <uapi/linux/bits.h>
-#include <uapi/linux/time.h>

#include <vdso/align.h>
#include <vdso/bits.h>
diff --git a/include/vdso/getrandom.h b/include/vdso/getrandom.h
index 1d9dbd4d76c1..f766cf913d74 100644
--- a/include/vdso/getrandom.h
+++ b/include/vdso/getrandom.h
@@ -6,7 +6,7 @@
#ifndef _VDSO_GETRANDOM_H
#define _VDSO_GETRANDOM_H

-#include <linux/types.h>
+#include <vdso/types.h>

#define CHACHA_KEY_SIZE 32
#define CHACHA_BLOCK_SIZE 64
diff --git a/include/vdso/gettime.h b/include/vdso/gettime.h
index 16a0a0556b86..17e08fa5936b 100644
--- a/include/vdso/gettime.h
+++ b/include/vdso/gettime.h
@@ -2,7 +2,7 @@
#ifndef _VDSO_GETTIME_H
#define _VDSO_GETTIME_H

-#include <linux/types.h>
+#include <vdso/types.h>

struct __kernel_timespec;
struct __kernel_old_timeval;
diff --git a/include/vdso/time.h b/include/vdso/time.h
index 739f53cd2949..da417a347824 100644
--- a/include/vdso/time.h
+++ b/include/vdso/time.h
@@ -2,7 +2,7 @@
#ifndef __VDSO_TIME_H
#define __VDSO_TIME_H

-#include <uapi/linux/types.h>
+#include <vdso/types.h>

struct timens_offset {
s64 sec;
--
2.50.1