From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAz0-0002LO-0q for qemu-devel@nongnu.org; Tue, 01 Jan 2013 18:10:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqAyy-0000PK-Mi for qemu-devel@nongnu.org; Tue, 01 Jan 2013 18:10:53 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:54036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAyy-0000P3-CM for qemu-devel@nongnu.org; Tue, 01 Jan 2013 18:10:52 -0500 Message-ID: <1357081852.31530.10.camel@Quad> From: Laurent Vivier Date: Wed, 02 Jan 2013 00:10:52 +0100 In-Reply-To: <1356037211-19530-1-git-send-email-laurent@vivier.eu> References: <1356037211-19530-1-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] linux-user: correct msgrcv() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio Ping ! Le jeudi 20 d=C3=A9cembre 2012 =C3=A0 22:00 +0100, Laurent Vivier a =C3=A9c= rit : > All parameters must be swapped before the call of do_msgrcv(). >=20 > Allow faked (debian fakeroot daemon) to work properly. >=20 > WITHOUT this patch: >=20 > $ faked-sysv --foreground --debug > using 1723744788 as msg key > msg_key=3D1723744788 > 1723744788:431 > FAKEROOT: msg=3D131072, key=3D1723744788 > FAKEROOT: r=3D-1, received message type=3D-150996052, message=3D-16021933= 0 > FAKEROOT, get_msg: Bad address > r=3D14, EINTR=3D4 > fakeroot: clearing up message queues and semaphores, signal=3D-1 > fakeroot: database save FAILED >=20 > WITH this patch: >=20 > $ faked-sysv --foreground --debug > using 1569385744 as msg key > msg_key=3D1569385744 > 1569385744:424 > FAKEROOT: msg=3D0, key=3D1569385744 > ^C > fakeroot: clearing up message queues and semaphores, signal=3D2 > fakeroot: database save FAILED >=20 > Signed-off-by: Laurent Vivier > --- > linux-user/syscall.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 7bab006..78cb764 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -2901,7 +2901,7 @@ static inline abi_long do_msgrcv(int msqid, abi_lon= g msgp, > return -TARGET_EFAULT; > =20 > host_mb =3D g_malloc(msgsz+sizeof(long)); > - ret =3D get_errno(msgrcv(msqid, host_mb, msgsz, tswapal(msgtyp), msg= flg)); > + ret =3D get_errno(msgrcv(msqid, host_mb, msgsz, msgtyp, msgflg)); > =20 > if (ret > 0) { > abi_ulong target_mtext_addr =3D msgp + sizeof(abi_ulong); > @@ -3199,7 +3199,7 @@ static abi_long do_ipc(unsigned int call, int first= , > break; > } > =20 > - ret =3D do_msgrcv(first, tmp->msgp, second, tmp->msgtyp,= third); > + ret =3D do_msgrcv(first, tswapal(tmp->msgp), second, tsw= apal(tmp->msgtyp), third); > =20 > unlock_user_struct(tmp, ptr, 0); > break; --=20 "Just play. Have fun. Enjoy the game." - Michael Jordan "Just play. Have fun. Enjoy the game." - Michael Jordan