[CRIU] [PATCH 06/13] vdso: Introduce vdso pie-engine

Pavel Emelyanov xemul at parallels.com
Thu May 23 07:04:11 EDT 2013


On 05/22/2013 11:09 PM, Cyrill Gorcunov wrote:
> 
> It's quite minimal at moment and provides only two helpers
> 
>  - vdso_redirect_calls, to patch vdso area redirectling
>    calls to some new place.
> 
>  - vdso_fill_symtable, to parse vma area as vdso library
>    and fill symbols table with offsets and names.
> 
> Because these routines will be needed in both regular criu
> code and restorer code -- we compile it in pie format.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/vdso.h |  67 ++++++++++++++++
>  pie/Makefile   |   1 +
>  pie/vdso.c     | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 309 insertions(+)
>  create mode 100644 include/vdso.h
>  create mode 100644 pie/vdso.c
> 
> --- /dev/null
> +++ b/pie/vdso.c
> @@ -0,0 +1,241 @@
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <unistd.h>
> +#include <string.h>
> +#include <elf.h>
> +#include <fcntl.h>
> +
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <sys/mman.h>
> +
> +#include "asm/memcpy_64.h"
> +#include "asm/string.h"
> +#include "asm/types.h"
> +
> +#include "compiler.h"
> +#include "crtools.h"
> +#include "vdso.h"
> +#include "log.h"
> +
> +#ifdef LOG_PREFIX
> +# undef LOG_PREFIX
> +#endif
> +#define LOG_PREFIX "vdso: "
> +
> +#if defined(CONFIG_X86_64)

Please no. Use arch/x86/vdso.c for this. Please.

> +
> +typedef struct {
> +	u16	movabs;
> +	u64	imm64;
> +	u16	jmp_rax;
> +	u32	guards;
> +} __packed jmp_t;
> +
> +int vdso_redirect_calls(void *base_to, void *base_from, symtable_t *to, symtable_t *from)
> +{
> +	jmp_t jmp = {





More information about the CRIU mailing list