Received: from eggs.gnu.org ([2001:4830:134:3::10]:53397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcBRG-0002tp-4c for qemu-devel@nongnu.org; Wed, 16 Sep 2015 08:03:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcBRA-0000GD-Ae for qemu-devel@nongnu.org; Wed, 16 Sep 2015 08:03:50 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:49181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcBRA-0000G5-35 for qemu-devel@nongnu.org; Wed, 16 Sep 2015 08:03:44 -0400 Date: Wed, 16 Sep 2015 08:03:33 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <1891499047.12576877.1442405013208.JavaMail.zimbra@redhat.com> In-Reply-To: <55F95223.5050909@huawei.com> References: <1442333283-13119-1-git-send-email-marcandre.lureau@redhat.com> <1442333283-13119-4-git-send-email-marcandre.lureau@redhat.com> <55F935E4.2030705@huawei.com> <534883311.12512111.1442395999383.JavaMail.zimbra@redhat.com> <55F95223.5050909@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 03/46] ivhsmem: read do not accept more than sizeof(long) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Claudio Fontana Cc: marcandre lureau , drjones@redhat.com, cam@cs.ualberta.ca, qemu-devel@nongnu.org, stefanha@redhat.com ----- Original Message ----- > On 16.09.2015 11:33, Marc-Andr=C3=A9 Lureau wrote: > > ----- Original Message ----- > >> On 15.09.2015 18:07, marcandre.lureau@redhat.com wrote: > >>> From: Marc-Andr=C3=A9 Lureau > >>> > >>> ivshmem_read() only reads sizeof(long) from the input buffer. Accept= ing > >>> more could lead to fifo8 abort() on 32bit systems if fifo is not empt= y. > >>> > >>> Signed-off-by: Marc-Andr=C3=A9 Lureau > >>> --- > >>> hw/misc/ivshmem.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > >>> index cc76989..fb53b3f 100644 > >>> --- a/hw/misc/ivshmem.c > >>> +++ b/hw/misc/ivshmem.c > >>> @@ -272,7 +272,7 @@ static void ivshmem_receive(void *opaque, const > >>> uint8_t > >>> *buf, int size) > >>> =20 > >>> static int ivshmem_can_receive(void * opaque) > >>> { > >>> - return 8; > >>> + return sizeof(long); > >>> } > >>> =20 > >> > >> Is the right fix this one, or should ivshmem_read() not rely on > >> sizeof(long)? > >=20 > >=20 > > See my answer to Paolo: > > http://lists.nongnu.org/archive/html/qemu-devel/2015-07/msg05341.html >=20 > Sorry for not noticing the previous discussion.. >=20 > Still it would seem more sensible to say explicitly how big the field is = I > think, > especially if we want to make it possible to have independent server > implementations of this... >=20 > This field is used to communicate directly with another process on the ho= st > right? > Should we not mandate the communication interface quite precisely, in ord= er > to allow independent server development? > I'll push it further: do we need to consider endianness? It's the same ho= st I > know, but is the meaning of the field endian-independant, or fully > expressed? I am not aware of any specification, so following implementation it is 'lon= g' integer in native endianness I agree we could document and change the protocol, but this will likely bre= ak it and could be done in a different patch series. thanks