[CRIU] [PATCH 1/9] parasite: Make parasite arguments variable size

Douglas, William william.douglas at intel.com
Fri Mar 1 12:31:05 EST 2013


On Fri, Mar 1, 2013 at 8:02 AM, Pavel Emelyanov <xemul at parallels.com> wrote:
> Sometimes we don't know the exact amount of data we would want
> to send to parasite via args area (e.g. -- while draining fds).
>
> Fix this, by moving the args area behind the parasite blob and
> mmap-ing it with the run-time calculated size.
>
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
>
> ---
>  arch/arm/parasite-head.S   |  2 --
>  arch/x86/parasite-head.S   |  3 ---
>  include/parasite-syscall.h |  1 +
>  include/parasite.h         |  2 +-
>  parasite-syscall.c         | 12 +++++++++---
>  pie/gen-offsets.sh         |  2 +-
>  pie/pie.lds.S.in           |  2 ++
>  7 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/parasite-head.S b/arch/arm/parasite-head.S
> index b4bffe6..74fd4cb 100644
> --- a/arch/arm/parasite-head.S
> +++ b/arch/arm/parasite-head.S
> @@ -13,8 +13,6 @@ ENTRY(__export_parasite_head_start)
>  __export_parasite_cmd:
>         .long 0
>  __export_parasite_args:
> -       .long 0
> -       .space PARASITE_ARG_SIZE,0
>         .space PARASITE_STACK_SIZE,0
>
>          .space 228, 0
> diff --git a/arch/x86/parasite-head.S b/arch/x86/parasite-head.S
> index 289672c..0b62750 100644
> --- a/arch/x86/parasite-head.S
> +++ b/arch/x86/parasite-head.S
> @@ -15,9 +15,6 @@ ENTRY(__export_parasite_head_start)
>         .align 8
>  __export_parasite_cmd:
>         .long 0
> -__export_parasite_args:
> -       .long 0
> -       .space PARASITE_ARG_SIZE,0
>         .space PARASITE_STACK_SIZE,0
>  __export_parasite_stack:
>         .long 0
> diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
> index 2f32d03..ee5743e 100644
> --- a/include/parasite-syscall.h
> +++ b/include/parasite-syscall.h
> @@ -19,6 +19,7 @@ struct parasite_ctl {
>
>         unsigned int            *addr_cmd;                              /* addr for command */
>         void                    *addr_args;                             /* address for arguments */
> +       unsigned long           args_size;
>         int                     tsock;                                  /* transport socket for transfering fds */
>  };
>
> diff --git a/include/parasite.h b/include/parasite.h
> index 5d5b8df..66a559e 100644
> --- a/include/parasite.h
> +++ b/include/parasite.h
> @@ -2,7 +2,7 @@
>  #define __CR_PARASITE_H__
>
>  #define PARASITE_STACK_SIZE    (16 << 10)
> -#define PARASITE_ARG_SIZE      8196
> +#define PARASITE_ARG_SIZE_MIN  ( 1 << 13)
>
>  #define PARASITE_MAX_SIZE      (64 << 10)
>
> diff --git a/parasite-syscall.c b/parasite-syscall.c
> index 6cc6283..03b5546 100644
> --- a/parasite-syscall.c
> +++ b/parasite-syscall.c
> @@ -184,12 +184,12 @@ err:
>
>  static void *parasite_args_s(struct parasite_ctl *ctl, int args_size)
>  {
> -       BUG_ON(args_size > PARASITE_ARG_SIZE);
> +       BUG_ON(args_size > ctl->args_size);
>         return ctl->addr_args;
>  }
>
>  #define parasite_args(ctl, type) ({                            \
> -               BUILD_BUG_ON(sizeof(type) > PARASITE_ARG_SIZE); \
> +               BUILD_BUG_ON(sizeof(type) > PARASITE_ARG_SIZE_MIN);\

This check makes me wonder if MIN is the correct description here.
Isn't this a MAX check instead?


More information about the CRIU mailing list