[CRIU] [PATCH 2/4] restore: Align stack to 16 bytes for arm64

Christopher Covington cov at codeaurora.org
Mon Dec 28 06:44:04 PST 2015


Hi Vijaya,

Thanks for the patches. They look great--just one minor suggestion below.

On 12/28/2015 03:09 AM, Vijaya Kumar K wrote:
> arm64 expects stack to be aligned to 16 bytes.
> If stack pointer is not aligned clone system call
> fails during restore.
> 
> Signed-off-by: Vijaya Kumar K <vijayak at caviumnetworks.com>
> ---
>  cr-check.c   |    2 +-
>  cr-restore.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/cr-check.c b/cr-check.c
> index a3dc662..5b425f9 100644
> --- a/cr-check.c
> +++ b/cr-check.c
> @@ -808,7 +808,7 @@ struct clone_arg {
>  	 * Reserve some space for clone() to locate arguments
>  	 * and retcode in this place
>  	 */
> -	char stack[128] __attribute__((aligned (8)));
> +	char stack[128] __attribute__((aligned (16)));

The value of 16 is a bit of a magic number. It's nice that you added a
comment in one of the places but there are several others. What about
some sort of __stackaligned__ macro?

>  	char stack_ptr[0];
>  };
>  
> diff --git a/cr-restore.c b/cr-restore.c
> index 9fc1e3d..39c1b06 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -1094,7 +1094,7 @@ struct cr_clone_arg {
>  	 * Reserve some space for clone() to locate arguments
>  	 * and retcode in this place
>  	 */
> -	char stack[128] __attribute__((aligned (8)));
> +	char stack[128] __attribute__((aligned (16)));
>  	char stack_ptr[0];
>  	struct pstree_item *item;
>  	unsigned long clone_flags;
> 

Thanks,
Christopher Covington

-- 
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


More information about the CRIU mailing list