From a27f0e5cb00b0c8ba1da308262abb13ece70cf55 Mon Sep 17 00:00:00 2001 From: Alexander Kartashov Date: Tue, 29 Jan 2013 09:21:46 +0400 Subject: [PATCH] cr-restore: align the stack on 8-byte boundary The section 5.2.1.2 of the AAPCS says that the stack must be 8-byte aligned and this rule is broken when the thread restore_task_with_children() is forked by the function fork_with_pid() since the variable ca and its field stack are likely to be 4-byte aligned. This patch forces 8-byte alingment of the field cr_clone_arg::stack. This made the following tests pass on ARM: * static/shm, * static/ipc_namespace. Particulary the unaligned stack results in incorrect passing of the 64-bit argument to the function snprintf() in the function sysctl_write_u64(). Signed-off-by: Alexander Kartashov Signed-off-by: Pavel Emelyanov --- cr-restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cr-restore.c b/cr-restore.c index 7c2943595..323930e04 100644 --- a/cr-restore.c +++ b/cr-restore.c @@ -777,7 +777,7 @@ out: /* All arguments should be above stack, because it grows down */ struct cr_clone_arg { - char stack[PAGE_SIZE]; + char stack[PAGE_SIZE] __attribute__((aligned (8))); char stack_ptr[0]; struct pstree_item *item; unsigned long clone_flags;