[CRIU] [PATCH 8/8] pie: x86 -- Adjust size of parasite and restorer code

Pavel Emelyanov xemul at parallels.com
Fri May 15 04:25:12 PDT 2015


> @@ -2356,7 +2356,11 @@ static int prepare_restorer_blob(void)
>  	 * in turn will lead to set-exe-file prctl to fail with EBUSY.
>  	 */
>  
> +#if defined(CONFIG_X86_32) || defined(CONFIG_X86_64)
> +	restorer_len = round_up(sizeof(restorer_blob) + nr_gotpcrel * sizeof(long), PAGE_SIZE);

Please, define the nr_gotpcrel as 0 outside of this function for non-x32 case.

> +#else
>  	restorer_len = round_up(sizeof(restorer_blob), PAGE_SIZE);
> +#endif
>  	restorer = mmap(NULL, restorer_len,
>  			PROT_READ | PROT_WRITE | PROT_EXEC,
>  			MAP_PRIVATE | MAP_ANON, 0, 0);
> diff --git a/parasite-syscall.c b/parasite-syscall.c
> index 6f1bb66ed07f..e3cf2f8e4cf6 100644
> --- a/parasite-syscall.c
> +++ b/parasite-syscall.c
> @@ -38,7 +38,11 @@
>  #include "asm/dump.h"
>  #include "asm/restorer.h"
>  
> -#define parasite_size		(round_up(sizeof(parasite_blob), PAGE_SIZE))
> +#if defined(CONFIG_X86_32) || defined(CONFIG_X86_64)
> +# define parasite_size		(round_up(sizeof(parasite_blob) + nr_gotpcrel * sizeof(long), PAGE_SIZE))

Hm... Don't we want the PIE_SIZE() helper to factor out all of this with restorer?

> +#else
> +# define parasite_size		(round_up(sizeof(parasite_blob), PAGE_SIZE))
> +#endif
>  
>  static int can_run_syscall(unsigned long ip, unsigned long start, unsigned long end)
>  {
> 



More information about the CRIU mailing list