[CRIU] [PATCH] rst-malloc: return aligned pointers to sizeof(void *) (v2)
Andrew Vagin
avagin at virtuozzo.com
Mon Jan 25 19:30:24 PST 2016
On Fri, Jan 22, 2016 at 09:32:24PM +0300, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
>
> Stas found that if we don't align a pointer,
> futex and atomic operations can fail.
>
> v2: don't hard-code the size of void *
Pls, ignore this patch. rst_malloc is used instead of rst_realloc to
allocate arrays, so it's imposiable to add holes now.
I will send a new version soon.
>
> Cc: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
> rst-malloc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/rst-malloc.c b/rst-malloc.c
> index 14e0b41..153f0ce 100644
> --- a/rst-malloc.c
> +++ b/rst-malloc.c
> @@ -145,6 +145,8 @@ void *rst_mem_alloc(unsigned long size, int type)
>
> BUG_ON(!t->enabled);
>
> + size = round_up(size, sizeof(void *));
> +
> if ((t->free_bytes < size) && t->grow(t, size)) {
> pr_perror("Can't grow rst mem");
> return NULL;
> --
> 2.4.3
>
More information about the CRIU
mailing list