[Devel] [patch rh7 2/2] vdso: x86 -- Disable virtualization in native x86-32 mode

Cyrill Gorcunov gorcunov at virtuozzo.com
Tue Jun 23 15:17:47 PDT 2015


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(-)

Index: linux-pcs7.git/arch/x86/vdso/vdso32-setup.c
===================================================================
--- linux-pcs7.git.orig/arch/x86/vdso/vdso32-setup.c
+++ linux-pcs7.git/arch/x86/vdso/vdso32-setup.c
@@ -346,6 +346,22 @@ static struct page **uts_prep_vdso_pages
 		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
 	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