Commit f1d7964e authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

parasite: align parasite args with 4 bytes

>From the commit 64e74fab ("parasite: handle errors while a transport
socket is being created"), we have futex in parasite init args to
synchronize parasite and criu during initialization.
And man futex(2): "On all platforms, futexes are four-byte integers that
must be aligned on a four-byte boundary."
This is checked by kernel in get_futex_key():
	if (unlikely((address % sizeof(u32)) != 0))
		return -EINVAL;

So, we need to align parasite arguments on four bytes, while mapping
of parasite blob on page-aligned address will guarantee that it'll
be aligned on four bytes in memory.

Fixes:
(00.013468) -----------------------
(00.013470) Putting tsock into pid 22043
(00.014024) Error (criu/parasite-syscall.c:541): futex() returned an unexpected error: -22
(00.014026) Error (criu/parasite-syscall.c:541): BUG at criu/parasite-syscall.c:541

Cc: Andrew Vagin <avagin@virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 1b809cda
...@@ -26,5 +26,8 @@ SECTIONS ...@@ -26,5 +26,8 @@ SECTIONS
*(.group*) *(.group*)
*(.eh_frame*) *(.eh_frame*)
} }
/* Parasite args should have 4 bytes align, as we have futex inside. */
. = ALIGN(4);
__export_parasite_args = .; __export_parasite_args = .;
} }
...@@ -25,5 +25,7 @@ SECTIONS ...@@ -25,5 +25,7 @@ SECTIONS
*(*) *(*)
} }
/* Parasite args should have 4 bytes align, as we have futex inside. */
. = ALIGN(4);
__export_parasite_args = .; __export_parasite_args = .;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment