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_32 object
when !CONFIG_VE.

https://virtuozzo.atlassian.net/browse/VSTOR-130116

Feature: !CONFIG_VE build
Signed-off-by: Vladimir Riabchun <[email protected]>
---
 arch/x86/entry/vdso/vma.c    |  4 ++--
 arch/x86/kernel/process_64.c |  2 +-
 include/linux/ve.h           | 10 ++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index 63adef63f89b..04b5134362eb 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -80,7 +80,7 @@ static void vdso_fix_landing(const struct vdso_image *image,
                struct vm_area_struct *new_vma)
 {
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
-       if (in_ia32_syscall() && image == get_exec_env()->vdso_32) {
+       if (in_ia32_syscall() && image == ve_get_vdso_32(get_exec_env())) {
                struct pt_regs *regs = current_pt_regs();
                unsigned long vdso_land = image->sym_int80_landing_pad;
                unsigned long old_land_addr = vdso_land +
@@ -310,7 +310,7 @@ static int load_vdso32(void)
        if (vdso32_enabled != 1)  /* Other values all mean "disabled" */
                return 0;
 
-       return map_vdso(get_exec_env()->vdso_32, 0);
+       return map_vdso(ve_get_vdso_32(get_exec_env()), 0);
 }
 #endif
 
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 826bc3ba236f..3761380d68da 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -945,7 +945,7 @@ long do_arch_prctl_64(struct task_struct *task, int option, 
unsigned long arg2)
 # endif
 # if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
        case ARCH_MAP_VDSO_32:
-               return prctl_map_vdso(get_exec_env()->vdso_32, arg2);
+               return prctl_map_vdso(ve_get_vdso_32(get_exec_env()), arg2);
 # endif
        case ARCH_MAP_VDSO_64:
                return prctl_map_vdso(ve_get_vdso_64(get_exec_env()), arg2);
diff --git a/include/linux/ve.h b/include/linux/ve.h
index a7abca2849dc..c64860664b62 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_32(struct ve_struct *ve)
+{
+       return ve->vdso_32;
+}
+
 static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
 {
        return ve->vdso_64;
@@ -341,6 +346,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_32(struct ve_struct *ve)
+{
+       return (struct vdso_image *)&vdso_image_32;
+}
+
 static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
 {
        return (struct vdso_image *)&vdso_image_64;
-- 
2.47.1

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to