From nobody Fri May 3 12:06:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1502357831612200.7032121868316; Thu, 10 Aug 2017 02:37:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A389D25A7A2; Thu, 10 Aug 2017 09:37:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B258094AC2; Thu, 10 Aug 2017 09:37:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9ACB24BB79; Thu, 10 Aug 2017 09:37:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v7A9aq2k010211 for ; Thu, 10 Aug 2017 05:36:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6DC9A93415; Thu, 10 Aug 2017 09:36:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84A5B93422; Thu, 10 Aug 2017 09:36:46 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F119C04CE72; Thu, 10 Aug 2017 09:36:42 +0000 (UTC) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dfjcf-0007sS-7p; Thu, 10 Aug 2017 09:19:21 +0000 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A389D25A7A2 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A389D25A7A2 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9F119C04CE72 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=christian.ehrhardt@canonical.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9F119C04CE72 From: Christian Ehrhardt To: Libvirt Devel Date: Thu, 10 Aug 2017 11:19:19 +0200 Message-Id: <1502356759-3243-1-git-send-email-christian.ehrhardt@canonical.com> X-Greylist: Delayed for 00:17:21 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 10 Aug 2017 09:36:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 10 Aug 2017 09:36:45 +0000 (UTC) for IP:'91.189.89.112' DOMAIN:'youngberry.canonical.com' HELO:'youngberry.canonical.com' FROM:'christian.ehrhardt@canonical.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD) 91.189.89.112 youngberry.canonical.com 91.189.89.112 youngberry.canonical.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Fam Zheng , Christian Ehrhardt Subject: [libvirt] [PATCH] virt-aa-helper: locking disk files for qemu 2.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 10 Aug 2017 09:37:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Testing qemu-2.10-rc2 shows issues like: qemu-system-x86_64: -drive file=3D/var/lib/uvtool/libvirt/images/kvmguest= - \ artful-normal.qcow,format=3Dqcow2,if=3Dnone,id=3Ddrive-virtio-disk0: Failed to lock byte 100 It seems the following qemu commit changed the needs for the backing image rules: (qemu) commit 244a5668106297378391b768e7288eb157616f64 Author: Fam Zheng file-posix: Add image locking to perm operations The block appears as: apparmor=3D"DENIED" operation=3D"file_lock" [...] name=3D"/var/lib/uvtool/libvirt/images/kvmguest-artful-normal.qcow" [...] comm=3D"qemu-system-x86" requested_mask=3D"k" denied_mask=3D"k" With that qemu change in place the rules generated for the image and backing files need the allowance to also lock (k) the files. Disks are added via add_file_path and with this fix rules now get that permission, but no other rules are changed, example: - "/var/lib/uvtool/libvirt/images/kvmguest-artful-normal-a2.qcow" rw, + "/var/lib/uvtool/libvirt/images/kvmguest-artful-normal-a2.qcow" rwk Signed-off-by: Christian Ehrhardt --- src/security/virt-aa-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 35dcb35..ab82f12 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -892,11 +892,11 @@ add_file_path(virDomainDiskDefPtr disk, =20 if (depth =3D=3D 0) { if (disk->src->readonly) - ret =3D vah_add_file(buf, path, "r"); + ret =3D vah_add_file(buf, path, "rk"); else - ret =3D vah_add_file(buf, path, "rw"); + ret =3D vah_add_file(buf, path, "rwk"); } else { - ret =3D vah_add_file(buf, path, "r"); + ret =3D vah_add_file(buf, path, "rk"); } =20 if (ret !=3D 0) --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list