[Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:37:05 MSK 2026


include/linux/ve.h includes asm/vdso.h for struct vdso_image, which
struct ve_struct keeps two pointers to - the per-Container copies of the
VDSO images.  The header is x86-only, and ve.h is included from a lot of
generic code, so building for an architecture without it fails
everywhere at once - User Mode Linux, which we now want for KUnit, has no
asm/vdso.h at all:

  include/linux/ve.h:21:10: fatal error: asm/vdso.h: No such file or
                            directory

A forward declaration of struct vdso_image is all the rest of the header
needs there, since nothing outside x86 dereferences one.  For the same
reason compile the CONFIG_VE=n stubs of ve_get_vdso_32() /
ve_get_vdso_64() on x86 only: they hand out vdso_image_32 / vdso_image_64,
which exist nowhere else, and their callers are all in arch/x86.

Also drop the duplicated linux/binfmts.h include while touching this
block.

Feature: mm: vdso virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 include/linux/ve.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/linux/ve.h b/include/linux/ve.h
index cba827260d07..46e67d00cf78 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -18,11 +18,19 @@
 #include <linux/kthread.h>
 #include <linux/binfmts.h>
 #include <linux/tty_driver.h>
-#include <asm/vdso.h>
 #include <linux/time_namespace.h>
-#include <linux/binfmts.h>
 #include <linux/pid.h>
 
+/*
+ * struct vdso_image and the static images the stubs below hand out are
+ * x86-only; User Mode Linux has no asm/vdso.h at all.
+ */
+#ifdef CONFIG_X86
+#include <asm/vdso.h>
+#else
+struct vdso_image;
+#endif
+
 struct nsproxy;
 struct user_namespace;
 struct ve_namespace;
@@ -366,6 +374,7 @@ static inline void ve_setup_task(struct task_struct *p, struct ve_struct *ve) {
 
 static inline void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool)) { }
 
+#ifdef CONFIG_X86
 static inline struct vdso_image *ve_get_vdso_32(struct ve_struct *ve)
 {
 	return (struct vdso_image *)&vdso_image_32;
@@ -375,6 +384,7 @@ static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
 {
 	return (struct vdso_image *)&vdso_image_64;
 }
+#endif /* CONFIG_X86 */
 
 #endif	/* CONFIG_VE */
 
-- 
2.47.1



More information about the Devel mailing list