[Devel] [PATCH RHEL7 COMMIT] ve/vdso: x86 -- Disable virtualization in native x86-32 mode

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 24 06:37:54 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.17
------>
commit 8cbf01485bf1fcc88cec62ac2c4cb92b410f4e75
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Wed Jun 24 17:37:54 2015 +0400

    ve/vdso: x86 -- Disable virtualization in native x86-32 mode
    
    Supporting native x86-32 vDSO with OS version virtualization causes too many
    problems: vanilla kernel has all this stuff completely rewritten so we can't
    just fetch various patches. Moreover i686 build uses that named fixed mappings
    for vDSO which are shared accross all tasks in the system thus to virtualize
    it we need to get rid of fixed mapping and do runtime relocations over vDSO
    code (remember it's x86-32, here is no RIP arressing).
    
    Thus lets move simplier -- in case if this is i686 case (native x86-32 mode)
    and we detect that someone is asked for vDSO virtualization, simply print out
    a warning that such mode is not supported BUT continue execution with
    nonvirtualized vDSO, this is better than killing process (lets userspace
    apps decide if they want or not to continue execution with old kernel
    version).
    
    https://jira.sw.ru/browse/PSBM-30093
    https://bugzilla.openvz.org/show_bug.cgi?id=2768
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
    
    CC: Vladimir Davydov <vdavydov at virtuozzo.com>
    CC: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 arch/x86/vdso/vdso32-setup.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 6020768..d49dffa 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -346,6 +346,22 @@ static struct page **uts_prep_vdso_pages_locked(int map)
 		new_version = KERNEL_VERSION(n1, n2, n3);
 		if (new_version == LINUX_VERSION_CODE)
 			goto out;
+#ifdef CONFIG_X86_32
+		else {
+			/*
+			 * Native x86-32 mode requires vDSO runtime
+			 * relocations applied which is not supported
+			 * in the old vanilla kernels, moreover even
+			 * being ported we would break compatibility
+			 * with rhel5 vdso which has addresses hardcoded.
+			 * Thus simply warn about this problem and
+			 * continue execution without virtualization.
+			 * After all i686 is pretty outdated nowadays.
+			 */
+			pr_warn_once("x86-32 vDSO virtualization is not supported.");
+			goto out;
+		}
+#endif
 	} else {
 		/*
 		 * If admin is passed malformed string here
@@ -393,14 +409,6 @@ static struct page **uts_prep_vdso_pages_locked(int map)
 	pr_debug("vDSO version transition %d -> %d for VE %d\n",
 		 LINUX_VERSION_CODE, new_version, ve->veid);
 
-#ifdef CONFIG_X86_32
-	__set_fixmap(FIX_VDSO, page_to_pfn(new_pages[0]) << PAGE_SHIFT,
-		     map ? PAGE_READONLY_EXEC : PAGE_NONE);
-
-	/* flush stray tlbs */
-	flush_tlb_all();
-#endif
-
 out_unlock:
 	mutex_unlock(&vdso32_mutex);
 out:



More information about the Devel mailing list