From 7a80f26f467ca97a0899c0f73ef2177772bee139 Mon Sep 17 00:00:00 2001 From: olefirenque Date: Wed, 30 Nov 2022 14:12:38 +0300 Subject: [PATCH] fix: get rid of MREMAP_MAYMOVE flag in __mremap Signed-off-by: olefirenque --- porting/linux/user/src/malloc/malloc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/porting/linux/user/src/malloc/malloc.c b/porting/linux/user/src/malloc/malloc.c index 3fc1a08c..5e906c71 100644 --- a/porting/linux/user/src/malloc/malloc.c +++ b/porting/linux/user/src/malloc/malloc.c @@ -827,10 +827,16 @@ void *realloc(void *p, size_t n) } newlen = (newlen + PAGE_SIZE-1) & -PAGE_SIZE; if (oldlen == newlen) return p; +#ifndef MUSL_ITERATE_AND_STATS_API base = __mremap(base, oldlen, newlen, MREMAP_MAYMOVE); +#else + base = __mremap(base, oldlen, newlen, 0); +#endif if (base == (void *)-1) goto copy_realloc; +#ifndef MUSL_ITERATE_AND_STATS_API self = (void *)(base + extra); +#endif self->csize = newlen - extra; #ifdef MALLOC_RED_ZONE self->usize = user_size; -- GitLab