From nobody Thu May 15 18:00:16 2025 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; dmarc=fail(p=none dis=none) header.from=canonical.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534227527662978.4273960701499; Mon, 13 Aug 2018 23:18:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2683C057F82; Tue, 14 Aug 2018 06:18:45 +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 825ABABDFA; Tue, 14 Aug 2018 06:18:45 +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 2F7D74A46D; Tue, 14 Aug 2018 06:18:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7E6Ibh6031717 for ; Tue, 14 Aug 2018 02:18:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E02D60921; Tue, 14 Aug 2018 06:18:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4339E6E518 for ; Tue, 14 Aug 2018 06:18:32 +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 130223082A3D for ; Tue, 14 Aug 2018 06:18:32 +0000 (UTC) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpSf0-0002Mo-Sw; Tue, 14 Aug 2018 06:18:30 +0000 From: Christian Ehrhardt To: libvir-list@redhat.com, =?UTF-8?q?Guido=20G=C3=BCnther?= , intrigeri , Jamie Strandboge Date: Tue, 14 Aug 2018 08:18:22 +0200 Message-Id: <20180814061822.15439-6-christian.ehrhardt@canonical.com> In-Reply-To: <20180814061822.15439-1-christian.ehrhardt@canonical.com> References: <20180814061822.15439-1-christian.ehrhardt@canonical.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 14 Aug 2018 06:18:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 14 Aug 2018 06:18:32 +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: -5 (RCVD_IN_DNSWL_HI) 91.189.89.112 youngberry.canonical.com 91.189.89.112 youngberry.canonical.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Christian Ehrhardt Subject: [libvirt] [PATCH v2 5/5] apparmor: allow to preserve /dev mountpoints into qemu namespaces X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: 20180813143946.29346-1-christian.ehrhardt@canonical.com 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 14 Aug 2018 06:18:46 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Libvirt now tries to preserve all mounts under /dev in qemu namespaces. The old rules only listed a set of known paths but those are no more enough. I found some due to containers like /dev/.lxc/* and such but also /dev/cons= ole and /dev/net/tun. Libvirt is correct to do so, but we can no more predict the names properly,= so we modify the rule to allow a wildcard based pattern matching what libvirt = does. Signed-off-by: Christian Ehrhardt --- examples/apparmor/usr.sbin.libvirtd | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sb= in.libvirtd index 3ff43c32a2..8625862ced 100644 --- a/examples/apparmor/usr.sbin.libvirtd +++ b/examples/apparmor/usr.sbin.libvirtd @@ -33,17 +33,11 @@ mount options=3D(rw,rslave) -> /, mount options=3D(rw, nosuid) -> /{var/,}run/libvirt/qemu/*.dev/, =20 - mount options=3D(rw, move) /dev/ -> /{var/,}run/libvirt/qemu/*= .dev/, - mount options=3D(rw, move) /dev/hugepages/ -> /{var/,}run/libvirt/qemu/*= .hugepages/, - mount options=3D(rw, move) /dev/mqueue/ -> /{var/,}run/libvirt/qemu/*= .mqueue/, - mount options=3D(rw, move) /dev/pts/ -> /{var/,}run/libvirt/qemu/*= .pts/, - mount options=3D(rw, move) /dev/shm/ -> /{var/,}run/libvirt/qemu/*= .shm/, - - mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*.dev/ -> /dev= /, - mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*.hugepages/ -> /dev= /hugepages/, - mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*.mqueue/ -> /dev= /mqueue/, - mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*.pts/ -> /dev= /pts/, - mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*.shm/ -> /dev= /shm/, + # libvirt provides any mounts under /dev to qemu namespaces + mount options=3D(rw, move) /dev/ -> /{var/,}run/libvirt/qemu/*.dev/, + mount options=3D(rw, move) /dev/** -> /{var/,}run/libvirt/qemu/*{/,}, + mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*.dev/ -> /dev/, + mount options=3D(rw, move) /{var/,}run/libvirt/qemu/*{/,} -> /dev/**, =20 network inet stream, network inet dgram, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list