From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsU9z-0002Fs-9f for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:21:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsU9u-0004ji-6c for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:21:54 -0400 Received: from jessie.kos.to ([212.47.231.226]:49978 helo=pilvi.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsU9t-0004dg-Vx for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:21:50 -0400 Date: Fri, 7 Oct 2016 12:21:43 +0000 From: Riku Voipio Message-ID: <20161007122143.GC28620@kos.to> References: <20160930233927.GA5887@nyan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160930233927.GA5887@nyan> Subject: Re: [Qemu-devel] [PATCH] linux-user: use libc wrapper instead of direct mremap syscall List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Felix Janda Cc: qemu-devel@nongnu.org On Fri, Sep 30, 2016 at 07:39:27PM -0400, Felix Janda wrote: > This commit essentially reverts commit > 3af72a4d98dca033492102603734cbc63cd2694a, which has replaced > five-argument calls to mremap() by direct mremap syscalls for > compatibility with glibc older than version 2.4. > > The direct syscall was buggy for 64bit targets on 32bit hosts > because of the default integer type promotions. Since glibc-2.4 > is now a decade old, we can remove this workaround. Applied this and the patch to linux-user Thanks, Riku > Signed-off-by: Felix Janda > --- > linux-user/mmap.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/linux-user/mmap.c b/linux-user/mmap.c > index c4371d9..ffd099d 100644 > --- a/linux-user/mmap.c > +++ b/linux-user/mmap.c > @@ -17,8 +17,6 @@ > * along with this program; if not, see . > */ > #include "qemu/osdep.h" > -#include > -#include > > #include "qemu.h" > #include "qemu-common.h" > @@ -681,10 +679,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, > mmap_lock(); > > if (flags & MREMAP_FIXED) { > - host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), > - old_size, new_size, > - flags, > - g2h(new_addr)); > + host_addr = mremap(g2h(old_addr), old_size, new_size, > + flags, g2h(new_addr)); > > if (reserved_va && host_addr != MAP_FAILED) { > /* If new and old addresses overlap then the above mremap will > @@ -700,10 +696,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, > errno = ENOMEM; > host_addr = MAP_FAILED; > } else { > - host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), > - old_size, new_size, > - flags | MREMAP_FIXED, > - g2h(mmap_start)); > + host_addr = mremap(g2h(old_addr), old_size, new_size, > + flags | MREMAP_FIXED, g2h(mmap_start)); > if (reserved_va) { > mmap_reserve(old_addr, old_size); > } > -- > 2.7.3 > >