From nobody Sun May 19 06:23:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674035020; cv=none; d=zohomail.com; s=zohoarc; b=MgiLiGXRX133ovVgIdOwzXQ61ENv3NnfM0xyRcE+M4q+vQXrtGFWsQfDuZmRgUZ2PB8orTofXUs81OERm6b1XOjSva40ioKRbz7qCV4gY1qiuqtROYykKmaFyGcZuo3yztokm4+wu/ZvlqKvZwJuLslHlWJbQI8FdJLvLhEoxBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674035020; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tAfGKas0FuWpSNSWLs847MWkcS0gvmsh9h/bngY/2Ng=; b=eNEJhQoO6Lh+i2VsW/vuAOJtq/eGFYH31jTF7hJJWEQdQD7XWMoq14fNBjl5uxcSA4Yxfhfsey4lC8AJX+tMH7fenB/TTLe1gC0W7wE2LzZwjR8BG81MIZTDhVOqvtvUftEn1d8MnXzs/xfV616wfS0nX7qSjDs3tAsT00/mXlM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674035020764950.1509361692038; Wed, 18 Jan 2023 01:43:40 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-RJmwSS3GOCygbEH4gEbWcA-1; Wed, 18 Jan 2023 04:43:34 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7A193C021A3; Wed, 18 Jan 2023 09:43:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E37492B00; Wed, 18 Jan 2023 09:43:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 79CBB1946A45; Wed, 18 Jan 2023 09:43:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B399619465B7 for ; Wed, 18 Jan 2023 09:43:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 640AD40C115E; Wed, 18 Jan 2023 09:43:22 +0000 (UTC) Received: from harajuku.usersys.redhat.com (ovpn-193-15.brq.redhat.com [10.40.193.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C26040C6EC4; Wed, 18 Jan 2023 09:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674035019; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tAfGKas0FuWpSNSWLs847MWkcS0gvmsh9h/bngY/2Ng=; b=Cp6+u4UQ1VnRG4nVN/zkHaAKv2/NbqE8FA1h4CK3mYw+Xpx8vyLfoctrd6evPkmd6sqgTa XyX2cPquUI0yxxRWdkylKaPSRQbVOjhasx0VniXNltYzvwD9n0TN9snvCzNKL+E/Z2GGqx ntk8Tn8f5uADuYIjFj7kBtUgAQsdWao= X-MC-Unique: RJmwSS3GOCygbEH4gEbWcA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 1/1] apparmor: Allow umount(/dev) Date: Wed, 18 Jan 2023 10:43:18 +0100 Message-Id: <20230118094318.114075-2-abologna@redhat.com> In-Reply-To: <20230118094318.114075-1-abologna@redhat.com> References: <20230118094318.114075-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: christian.ehrhardt@canonical.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674035021421100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Commit 379c0ce4bfed introduced a call to umount(/dev) performed inside the namespace that we run QEMU in. As a result of this, on machines using AppArmor, VM startup now fails with internal error: Process exited prior to exec: libvirt: QEMU Driver error: failed to umount devfs on /dev: Permission denied The corresponding denial is AVC apparmor=3D"DENIED" operation=3D"umount" profile=3D"libvirtd" name=3D"/dev/" pid=3D70036 comm=3D"rpc-libvirtd" Extend the AppArmor configuration for virtqemud and libvirtd so that this operation is allowed. Signed-off-by: Andrea Bolognani Reviewed-by: Jim Fehlig Reviewed-by: Michal Privoznik --- src/security/apparmor/usr.sbin.libvirtd.in | 1 + src/security/apparmor/usr.sbin.virtqemud.in | 1 + 2 files changed, 2 insertions(+) diff --git a/src/security/apparmor/usr.sbin.libvirtd.in b/src/security/appa= rmor/usr.sbin.libvirtd.in index 886f1ad518..edb8dd8e26 100644 --- a/src/security/apparmor/usr.sbin.libvirtd.in +++ b/src/security/apparmor/usr.sbin.libvirtd.in @@ -35,6 +35,7 @@ profile libvirtd @sbindir@/libvirtd flags=3D(attach_disco= nnected) { mount options=3D(rw,rslave) -> /, mount options=3D(rw, nosuid) -> /{var/,}run/libvirt/qemu/*.dev/, umount /{var/,}run/libvirt/qemu/*.dev/, + umount /dev/, =20 # libvirt provides any mounts under /dev to qemu namespaces mount options=3D(rw, move) /dev/ -> /{,var/}run/libvirt/qemu/*.dev/, diff --git a/src/security/apparmor/usr.sbin.virtqemud.in b/src/security/app= armor/usr.sbin.virtqemud.in index 3de03d49fc..f269c60809 100644 --- a/src/security/apparmor/usr.sbin.virtqemud.in +++ b/src/security/apparmor/usr.sbin.virtqemud.in @@ -35,6 +35,7 @@ profile virtqemud @sbindir@/virtqemud flags=3D(attach_dis= connected) { mount options=3D(rw,rslave) -> /, mount options=3D(rw, nosuid) -> /{var/,}run/libvirt/qemu/*.dev/, umount /{var/,}run/libvirt/qemu/*.dev/, + umount /dev/, =20 # libvirt provides any mounts under /dev to qemu namespaces mount options=3D(rw, move) /dev/ -> /{,var/}run/libvirt/qemu/*.dev/, --=20 2.39.0