[Devel] [PATCH VZ10 v4 03/44] fixup! ve, x86_64: add per-ve vdso mapping.
Vladimir Riabchun
vladimir.riabchun at virtuozzo.com
Wed Jun 3 00:10:21 MSK 2026
With !CONFIG_VE get_exec_env() returns NULL, all accesses to
vdso fields are done without config check.
Add helper that return pointer to vdso_image_64 object
when !CONFIG_VE.
https://virtuozzo.atlassian.net/browse/VSTOR-130116
Feature: !CONFIG_VE build
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
---
arch/x86/entry/vdso/vma.c | 2 +-
arch/x86/kernel/process_64.c | 2 +-
include/linux/ve.h | 10 ++++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index 6427a3a10d15..63adef63f89b 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -320,7 +320,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
if (!vdso64_enabled)
return 0;
- return map_vdso(get_exec_env()->vdso_64, 0);
+ return map_vdso(ve_get_vdso_64(get_exec_env()), 0);
}
#ifdef CONFIG_COMPAT
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 18a02b62cc37..826bc3ba236f 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -948,7 +948,7 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
return prctl_map_vdso(get_exec_env()->vdso_32, arg2);
# endif
case ARCH_MAP_VDSO_64:
- return prctl_map_vdso(get_exec_env()->vdso_64, arg2);
+ return prctl_map_vdso(ve_get_vdso_64(get_exec_env()), arg2);
#endif
#ifdef CONFIG_ADDRESS_MASKING
case ARCH_GET_UNTAG_MASK:
diff --git a/include/linux/ve.h b/include/linux/ve.h
index 224acf012821..a7abca2849dc 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -279,6 +279,11 @@ extern bool is_ve_init_net(const struct net *net);
void ve_setup_task(struct task_struct *p, struct ve_struct *ve);
+static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
+{
+ return ve->vdso_64;
+}
+
#else /* CONFIG_VE */
#include <linux/init_task.h>
#define get_ve(ve) ((void)(ve), NULL)
@@ -336,6 +341,11 @@ static inline int vz_security_protocol_check(struct net *net, int protocol) { re
static inline void ve_setup_task(struct task_struct *p, struct ve_struct *ve) { }
+static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
+{
+ return (struct vdso_image *)&vdso_image_64;
+}
+
#endif /* CONFIG_VE */
struct seq_file;
--
2.47.1
More information about the Devel
mailing list