[CRIU] [PATCH 0/3] vdso proxy, v3

Andrew Vagin avagin at parallels.com
Wed May 15 16:38:14 EDT 2013


After remaping or unmaping vdso, another vma can be marked as vdso.

Here is a small example, which shows this problem.

[avagin at localhost ~]$ cat test3.c 
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/mman.h>

int main()
{
	void *p, *n;
	long size;

	scanf("%p %d %p", &p, &size, &n);

	mremap(p, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, n);
	mmap(p, size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

	scanf("%p %d %p", &p, &size, &n);
	return 0;
}

...
read(0, 0x7fff18d49000 8192 0x7fff18d4f000
"0x7fff18d49000 8192 0x7fff18d4f0"..., 1024) = 35
mremap(0x7fff18d49000, 8192, 8192, MREMAP_MAYMOVE|MREMAP_FIXED,
0x7fff18d4f000) = 0x7fff18d4f000
mmap(0x7fff18d49000, 8192, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fff18d49000
read(0, ^Z
...


7fff18cbc000-7fff18cdd000 rw-p 00000000 00:00 0 [stack]
7fff18d49000-7fff18d4b000 ---p 00000000 00:00 0 [vdso]
7fff18d4f000-7fff18d51000 r-xp 00000000 00:00 0 
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

The problem is in kernel code, but it affects only us

Look at setup_additional_pages and arch_vma_name.
A vma is marked as [vdso], if its start addess is equal to
current->mm->context.vdso

On Wed, May 15, 2013 at 07:56:58PM +0400, Cyrill Gorcunov wrote:
> Hi guys, here is vdso proxy series. The main change from
> previous series are
> 
>  - runtime vdso is not longer copied but rather remapped at
>    new place
> 
>  - parasite now can detect the new runtime vdso on dumping and
>    skip it from writting to image
> 
> Please take a look, thanks! At moment I'm thinking on how to
> test it automatically with zdtm help...
> 
> Cyrill Gorcunov (3):
>   vdso: Introduce vdso engine
>   vdso: Proxify vDSO code on restore
>   dump: Escape double dumping of mangled vDSO
> 
>  arch/arm/include/asm/vdso.h |  13 +++
>  arch/x86/Makefile           |   1 +
>  arch/x86/crtools.c          |  40 +++++++++
>  arch/x86/include/asm/vdso.h |  13 +++
>  arch/x86/vdso.c             | 204 ++++++++++++++++++++++++++++++++++++++++++++
>  cr-dump.c                   |   6 ++
>  cr-restore.c                |  83 +++++++++++++++++-
>  include/parasite-syscall.h  |   3 +
>  include/parasite.h          |   8 ++
>  include/restorer.h          |  12 +++
>  include/vdso.h              | 110 ++++++++++++++++++++++++
>  parasite-syscall.c          |  66 ++++++++++++++
>  pie/parasite.c              |  19 +++++
>  pie/restorer.c              |  54 ++++++++++++
>  14 files changed, 629 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm/include/asm/vdso.h
>  create mode 100644 arch/x86/include/asm/vdso.h
>  create mode 100644 arch/x86/vdso.c
>  create mode 100644 include/vdso.h
> 
> -- 
> 1.8.1.4



More information about the CRIU mailing list