From nobody Tue Feb 10 05:43:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770648080; cv=none; d=zohomail.com; s=zohoarc; b=WKW41F39dAQm8xzCrj3DOXEa+kMpkZwTwNeNCRMEj4vBm6rqgp4tsbvr/ypFqNwGS37ch/9dtDF0qclbkxGLvWTJ8QbH2v1bgPy89MwaW/DOFmYmE9mAwGikXK+OtOKq66fR5FtS5lgGd7w+NefqquvRQOaeWjzz2N+6ho0MMC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770648080; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=cfK4ixwdQqgGDl+2hbZZF9dUvXlt/5r7XWzTNDvwHm8=; b=Kge21vKB4reT964oylnhFf3hMIOPmnkQ+Wn6RY4aA7WY6R1VNhEj0OfS3FLp9Y/duT0liT6KfemC8vKNCezW83b03Z5urKnedIrRuqoUHFii5GIiivWO2baTYEh0G22IO9RG8riNjM5p1UTKuhvlW22pOcnD+PORv8DzHT2TKcw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17706480799918.416035994079152; Mon, 9 Feb 2026 06:41:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 831564402C; Mon, 9 Feb 2026 09:41:19 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1871E44533; Mon, 9 Feb 2026 09:07:05 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id BF7B843EF8; Mon, 9 Feb 2026 09:02:36 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AC8A941BA1 for ; Mon, 9 Feb 2026 08:47:58 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-690-DpHSD8y6O2mbWMRp5Kh73w-1; Mon, 09 Feb 2026 08:47:57 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 76E8618003F6 for ; Mon, 9 Feb 2026 13:47:56 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.226.251]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B5F901956056 for ; Mon, 9 Feb 2026 13:47:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770644878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cfK4ixwdQqgGDl+2hbZZF9dUvXlt/5r7XWzTNDvwHm8=; b=cedY84VuRULZZno3P1Xu/YKFIRoQSMyFfGG1bnL9CDyPDOhElAsI26LsfT/3+Fddnwyheq PXERFpT76jmpHJmn7vqs26UxcK59JcnW7zOmOc8o3SMQ0kPakYWY3U7x8ZAyU9WuY+G51I tmpZ3KYE+1DO1Uu4FYvvHUwaXbNlTUE= X-MC-Unique: DpHSD8y6O2mbWMRp5Kh73w-1 X-Mimecast-MFC-AGG-ID: DpHSD8y6O2mbWMRp5Kh73w_1770644876 To: devel@lists.libvirt.org Subject: [PATCH v2 33/38] security: Mark ROMs as read only when using AppArmor Date: Mon, 9 Feb 2026 14:47:07 +0100 Message-ID: <20260209134712.296670-34-abologna@redhat.com> In-Reply-To: <20260209134712.296670-1-abologna@redhat.com> References: <20260209134712.296670-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: MHfTIfEuQz9THwidh3PoKwuOq0sr6o4wY5vfympw0vI_1770644876 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: K6JHKHLFOBUP7CX5YGJFLGZRNMKYPM3F X-Message-ID-Hash: K6JHKHLFOBUP7CX5YGJFLGZRNMKYPM3F X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Andrea Bolognani via Devel Reply-To: Andrea Bolognani X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770648081560154100 Content-Type: text/plain; charset="utf-8"; x-default="true" Before this, attempting to use a ROM that was not explictly marked at read only resulted in an error at startup time. Signed-off-by: Andrea Bolognani --- src/security/virt-aa-helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index f4ec6b7826..3ac4740fb5 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1021,7 +1021,15 @@ get_files(vahControl * ctl) =20 if (ctl->def->os.loader && ctl->def->os.loader->path) { bool readonly =3D false; + + /* Look at the readonly attribute, but also keep in mind that ROMs + * are always loaded read-only regardless of whether the attribute + * is present. Validation ensures that nonsensical configurations + * (type=3Drom readonly=3Dno) are rejected long before we get here= */ virTristateBoolToBool(ctl->def->os.loader->readonly, &readonly); + if (ctl->def->os.loader->type =3D=3D VIR_DOMAIN_LOADER_TYPE_ROM) + readonly =3D true; + if (vah_add_file(&buf, ctl->def->os.loader->path, readonly ? "rk" : "rwk") !=3D 0) { --=20 2.53.0