From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0bRw-0003KY-Lq for qemu-devel@nongnu.org; Fri, 27 Jun 2014 15:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0bRq-0005Px-Gk for qemu-devel@nongnu.org; Fri, 27 Jun 2014 15:04:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0bRq-0005Pp-7t for qemu-devel@nongnu.org; Fri, 27 Jun 2014 15:04:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5RJ4Xf7030752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 27 Jun 2014 15:04:33 -0400 Date: Fri, 27 Jun 2014 20:04:29 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20140627190429.GI2408@work-vm> References: <1403858078-3402-1-git-send-email-dgilbert@redhat.com> <20140627143243.GC3536@redhat.com> <20140627144210.GD2408@work-vm> <20140627150447.GA4617@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140627150447.GA4617@redhat.com> Subject: Re: [Qemu-devel] [PATCH] Allow mismatched virtio config-len List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com * Michael S. Tsirkin (mst@redhat.com) wrote: > On Fri, Jun 27, 2014 at 03:42:10PM +0100, Dr. David Alan Gilbert wrote: > > * Michael S. Tsirkin (mst@redhat.com) wrote: > > > On Fri, Jun 27, 2014 at 09:34:38AM +0100, Dr. David Alan Gilbert (git) wrote: > > > > From: "Dr. David Alan Gilbert" > > > > > > > > Commit 'virtio: validate config_len on load' restricted config_len > > > > loaded from the wire to match the config_len that the device had. > > > > > > > > Unfortunately, there are cases where this isn't true, the one > > > > we found it on was the wqe addition in virtio-blk. > > > > > > I think you mean wce. > > > > Oops - yes. > > > > > > Allow mismatched config-lengths: > > > > *) If the version on the wire is shorter then ensure that the > > > > remainder is 0xff filled (as virtio_config_read does on > > > > out of range reads) > > > > *) If the version on the wire is longer, load what we have space > > > > for and skip the rest. > > > > > > > > Signed-off-by: Dr. David Alan Gilbert > > > > > > Looks good overall, but I am having thoughts about the > > > padding with 0xff. > > > We previously didn't do this (before virtio: validate config_len on > > > load) so it seems safest (at least for 2.1) not to do it now either. > > > > Who allocates that memory? If it's known to be a value then I agree; however > > if it's uninitialised then I think it's best to pick a value rather than > > have behaviour that depends on random junk in the memory. > > It's initialized: e.g. for net it includes the mac, > for block the wce value. OK, I've just posted a v2 that is the simplified code you suggested. (Not had quite as much testing as my previous version yet). Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK