From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9sa3-000222-Pi for qemu-devel@nongnu.org; Fri, 18 Dec 2015 05:48:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9sa0-0000dH-IT for qemu-devel@nongnu.org; Fri, 18 Dec 2015 05:48:11 -0500 Received: from mail113-249.mail.alibaba.com ([205.204.113.249]:54980 helo=us-alimail-mta1.hst.scl.en.alidc.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9sa0-0000c5-35 for qemu-devel@nongnu.org; Fri, 18 Dec 2015 05:48:08 -0500 References: <5673A718.40103@emindsoft.com.cn> <5673ACFA.6060900@emindsoft.com.cn> <5673D4BD.4080305@vivier.eu> From: Chen Gang Message-ID: <5673E459.7030901@emindsoft.com.cn> Date: Fri, 18 Dec 2015 18:47:53 +0800 MIME-Version: 1.0 In-Reply-To: <5673D4BD.4080305@vivier.eu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-user/syscall.c: Notice about lock bitmask translation for fcntl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier , riku.voipio@iki.fi Cc: Peter Maydell , qemu-devel , Richard Henderson On 2015年12月18日 17:41, Laurent Vivier wrote: > > > Le 18/12/2015 07:51, Chen Gang a écrit : >> >> I found this issue during my working time, it is about sw_64 (almost the >> same as alpha) host running i386 wine programs. >> >> I also found another issue, but I am not quite sure whether it is worth >> enough for our upstream: The related fix patch is below, which will let >> the initialization slower, but for most archs, they have no this issue. >> >> linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in target_mmap() >> >> In some architectures, they have no policy to zero MAP_ANONYMOUS memory, >> which will cause issue for qemu target_mmap. >> >> Signed-off-by: Chen Gang >> >> diff --git a/linux-user/mmap.c b/linux-user/mmap.c >> index 7b459d5..9c9152d 100644 >> --- a/linux-user/mmap.c >> +++ b/linux-user/mmap.c >> @@ -567,6 +567,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, >> printf("\n"); >> #endif >> tb_invalidate_phys_range(start, start + len); >> + if ((prot & PROT_WRITE) && (flags & MAP_ANONYMOUS) >> + && ((flags & MAP_PRIVATE) || (fd == -1))) { >> + memset(g2h(start), 0, len); >> + } > > IMHO, their kernel needs a fix, mmap(2): > > MAP_ANONYMOUS > The mapping is not backed by any file; its contents are initial‐ > ized to zero. > OK, Thanks. -- Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed