From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Fri, 21 Aug 2026 18:37:06 +0200 Subject: [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86 In-Reply-To: <20260821163718.187766-1-khorenko@virtuozzo.com> References: <20260821163718.187766-1-khorenko@virtuozzo.com> Message-ID: <20260821163718.187766-21-khorenko@virtuozzo.com> List-Id: From: Eva Kurchatova Every Container gets its own copy of the VDSO images so that the Linux version code inside them can be patched to whatever the Container's os_release says. All of that is built on vdso_image_64 / vdso_image_32, which exist on x86 only, while kernel/ve/ve.c is generic code - so the file does not compile on an architecture without them, User Mode Linux being the one we now want for KUnit: kernel/ve/ve.c: error: 'vdso_image_64' undeclared here (not in a function) Guard the ve0 initializer, copy_vdso()/ve_free_vdso() and their callers with CONFIG_X86, and give ve_free_vdso() a no-op stub so the error path of ve_create() stays as it is. Its err_vdso label stays reachable either way, since ve_mount_devtmpfs() jumps to it too. A Container on an architecture without a patchable VDSO simply keeps the host's. Feature: mm: vdso virtualization https://virtuozzo.atlassian.net/browse/VSTOR-134732 Signed-off-by: Eva Kurchatova Signed-off-by: Konstantin Khorenko --- kernel/ve/ve.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 73d1c3b4873e..3a9f3841fe55 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -85,8 +85,10 @@ struct ve_struct ve0 = { .meminfo_val = VE_MEMINFO_SYSTEM, .umh_running_helpers = ATOMIC_INIT(0), .umh_helpers_waitq = __WAIT_QUEUE_HEAD_INITIALIZER(ve0.umh_helpers_waitq), +#ifdef CONFIG_X86 .vdso_64 = (struct vdso_image*)&vdso_image_64, .vdso_32 = (struct vdso_image*)&vdso_image_32, +#endif }; EXPORT_SYMBOL(ve0); @@ -675,6 +677,7 @@ u64 ve_get_uptime(struct ve_struct *ve) } EXPORT_SYMBOL(ve_get_uptime); +#ifdef CONFIG_X86 static int copy_vdso(struct vdso_image **vdso_dst, const struct vdso_image *vdso_src) { struct vdso_image *vdso; @@ -712,6 +715,9 @@ static void ve_free_vdso(struct ve_struct *ve) kfree(ve->vdso_32); } } +#else +static inline void ve_free_vdso(struct ve_struct *ve) { } +#endif static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_css) { @@ -758,6 +764,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_ if (err) goto err_log; +#ifdef CONFIG_X86 err = copy_vdso(&ve->vdso_64, &vdso_image_64); if (err) goto err_vdso; @@ -765,6 +772,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_ err = copy_vdso(&ve->vdso_32, &vdso_image_32); if (err) goto err_vdso; +#endif err = ve_mount_devtmpfs(ve); if (err) @@ -1158,8 +1166,10 @@ static ssize_t ve_os_release_write(struct kernfs_open_file *of, char *buf, if (sscanf(buf, "%d.%d.%d", &n1, &n2, &n3) == 3) { new_version = ((n1 << 16) + (n2 << 8)) + n3; +#ifdef CONFIG_X86 *((int *)(ve->vdso_64->data + ve->vdso_64->sym_linux_version_code)) = new_version; *((int *)(ve->vdso_32->data + ve->vdso_32->sym_linux_version_code)) = new_version; +#endif } down_write(&uts_sem); -- 2.47.1