From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkeyO-00078I-IU for qemu-devel@nongnu.org; Thu, 15 Sep 2016 18:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkeyK-0004VY-7M for qemu-devel@nongnu.org; Thu, 15 Sep 2016 18:17:35 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkeyK-0004VK-0c for qemu-devel@nongnu.org; Thu, 15 Sep 2016 18:17:32 -0400 Received: by mail-wm0-f68.google.com with SMTP id g141so842315wmd.1 for ; Thu, 15 Sep 2016 15:17:31 -0700 (PDT) Sender: Paolo Bonzini References: <1473178269-16718-1-git-send-email-maxime.coquelin@redhat.com> <1473178269-16718-5-git-send-email-maxime.coquelin@redhat.com> From: Paolo Bonzini Message-ID: <2e349a9d-8609-b3d6-6681-537c4362c367@redhat.com> Date: Fri, 16 Sep 2016 00:16:29 +0200 MIME-Version: 1.0 In-Reply-To: <1473178269-16718-5-git-send-email-maxime.coquelin@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 4/4] virtio-net: Add MTU feature support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Maxime Coquelin , mst@redhat.com, qemu-devel@nongnu.org Cc: jasowang@redhat.com, Aaron Conole On 06/09/2016 18:11, Maxime Coquelin wrote: > VirtIONet *n = VIRTIO_NET(vdev); > struct virtio_net_config netcfg; > > + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_MTU)) { > + virtio_stw_p(vdev, &netcfg.mtu, n->mtu); > + } This write needs to be unconditional, otherwise you are leaking a few bytes of QEMU's stack (corresponding to netcfg.mtu) to the guest. Paolo > virtio_stw_p(vdev, &netcfg.status, n->status); > virtio_stw_p(vdev, &netcfg.max_virtqueue_pairs, n->max_queues); > memcpy(netcfg.mac, n->mac, ETH_ALEN);