[Devel] [PATCH RHEL7 COMMIT] vdso32: Fix monotonic time virtualization for ia32

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 5 15:49:06 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.32.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.32.6
------>
commit fcae4a8d7fe6ed8ceef240232c92bd0fcaeab5d1
Author: Dmitry Safonov <dsafonov at virtuozzo.com>
Date:   Mon Jun 5 16:49:04 2017 +0400

    vdso32: Fix monotonic time virtualization for ia32
    
    Monotonic time virtualization by a typo initializes 64-bit vdso
    for 32-bit processes. vdso32.addr was never inited - do this also.
    
    In case of 32-bit CT (which we yet do not support) that leads to
    kernel oops and then panic (dereferencing not initialized uts_ns->vdso):
    [   29.855267] BUG: unable to handle kernel paging request at ffffffffff700560
    [   29.855796] IP: [<ffffffff81077403>] __arch_setup_additional_pages.isra.2+0x293/0x370
    [   29.856743] Oops: 0002 [#1] SMP
    [   29.865576] CPU: 3 PID: 12377 Comm: bash ve: 7fdc70c8-7457-46e1-a615-6642eb956b81 Not tainted 3.10.0-514.16.1.vz7.32.6 #1 32.6
    [   29.866338] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-20170228_101828-anatol 04/01/2014
    [   29.875894] Call Trace:
    [   29.876095]  [<ffffffff8107762a>] syscall32_setup_pages+0x6a/0xb0
    [   29.876579]  [<ffffffff81277f84>] load_elf_binary+0xa44/0xe60
    [   29.877035]  [<ffffffff81277540>] ? load_elf_library+0x250/0x250
    [   29.877522]  [<ffffffff8121d165>] search_binary_handler+0xd5/0x300
    [   29.878032]  [<ffffffff8121e7c5>] do_execve_common.isra.30+0x665/0x730
    [   29.878548]  [<ffffffff8121eb29>] SyS_execve+0x29/0x30
    [   29.878976]  [<ffffffff816929e9>] stub_execve+0x69/0xa0
    
    In case of 64-bit CT with ia32 task that leads to overwriting
    64-bit vdso with timespec.
    
    Fixes: e955ddcd0d2c ("ve/vdso: virtualized monotonic gettime through vdso")
    
    https://jira.sw.ru/browse/PSBM-66888
    
    Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
    Acked-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 arch/x86/vdso/vdso32-setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 32c9a29..70e1cc4 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -399,8 +399,9 @@ static struct page **uts_prep_vdso_pages_locked(int map)
 	copy_page(page_address(new_pages[0]), page_address(vdso32_pages[0]));
 
 	addr = page_address(new_pages[0]);
+	uts_ns->vdso32.addr = addr;
 	*((int *)(addr + uts_ns->vdso32.version_off)) = new_version;
-	*((struct timespec*)(VDSO32_SYMBOL(uts_ns->vdso.addr, ve_start_timespec))) = ve->start_timespec;
+	*((struct timespec*)(VDSO32_SYMBOL(uts_ns->vdso32.addr, ve_start_timespec))) = ve->start_timespec;
 	smp_wmb();
 
 	pages = uts_ns->vdso32.pages = new_pages;


More information about the Devel mailing list