From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1by47n-0005Hl-Ln for qemu-devel@nongnu.org; Sat, 22 Oct 2016 17:46:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1by47k-0004J9-Ii for qemu-devel@nongnu.org; Sat, 22 Oct 2016 17:46:43 -0400 Received: from mail-qk0-x22d.google.com ([2607:f8b0:400d:c09::22d]:34862) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1by47k-0004Ix-DG for qemu-devel@nongnu.org; Sat, 22 Oct 2016 17:46:40 -0400 Received: by mail-qk0-x22d.google.com with SMTP id z190so193981214qkc.2 for ; Sat, 22 Oct 2016 14:46:40 -0700 (PDT) From: Rafael David Tinoco Date: Sat, 22 Oct 2016 21:46:35 +0000 Message-Id: <20161022214635.24353-1-rafael.tinoco@canonical.com> Subject: [Qemu-devel] [PATCH] vhost: secure vhost shared log files using argv paremeter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, 1626972@bugs.launchpad.net, rafael.tinoco@canonical.com Commit 31190ed7 added a migration blocker in vhost_dev_init() to check if memfd would succeed. It is better if this blocker first checks if vhost backend requires shared log. This will avoid a situation where a blocker is added inappropriately (e.g. shared log allocation fails when vhost backend doesn't support it). --- hw/virtio/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index bd051ab..742d0aa 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1122,7 +1122,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { error_setg(&hdev->migration_blocker, "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."); - } else if (!qemu_memfd_check()) { + } else if (vhost_dev_log_is_shared(hdev) && !qemu_memfd_check()) { error_setg(&hdev->migration_blocker, "Migration disabled: failed to allocate shared memory"); } -- 2.9.3