From nobody Tue Oct 28 08:10:26 2025 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=1760464587; cv=none; d=zohomail.com; s=zohoarc; b=XU+5yhptAYuoXW2LJCPimbkG29oBzjRywGmA4dEbFhqs9nQMvJgJhw9/d+u4EC8ABSUFivW3FXgDA1mJTpa7PjwAEoFGoSyeDILDbiocGFPit0odBdCgdjP+IG+PerV9eZdSdX3m+kPdg2/rjuhuacsXj/mwKIMqWZWttdeBk5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760464587; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=/f/QmKwuLhAEshhFX5r8DkT5FJq9X9wVCwpIz/JJ0bI=; b=GeOnZMl50rNbvtdB/F6y3kDgT0f8XqoLpyxUv9A9bhpvXrIKh15UfQrymzMbpBpLQAzNIbvnzR+IICZYOq21IMFXwECDJxiuTtkqZQEUoVrYWw030ntSIgQRlSrB3k54gQzb0QO+UiHkOMfbznTidqPclmZsO69XL1iRQpJpKtQ= 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 1760464587754618.5105680441; Tue, 14 Oct 2025 10:56:27 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A278841B8C; Tue, 14 Oct 2025 13:56:26 -0400 (EDT) Received: from [172.19.199.20] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 6C834443D1; Tue, 14 Oct 2025 13:55:11 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D4E2A43DEC; Tue, 14 Oct 2025 13:54:56 -0400 (EDT) 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 8278241A8A for ; Tue, 14 Oct 2025 13:54:54 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-J9O8QP6uMCq5OHOKVsdWRQ-1; Tue, 14 Oct 2025 13:54:52 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 11A481956086 for ; Tue, 14 Oct 2025 17:54:52 +0000 (UTC) Received: from colepc.redhat.com (unknown [10.22.82.70]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 84B451800452; Tue, 14 Oct 2025 17:54:51 +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=-3.1 required=5.0 tests=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=1760464494; h=from:from: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; bh=/f/QmKwuLhAEshhFX5r8DkT5FJq9X9wVCwpIz/JJ0bI=; b=P0637E5S8ex9DU4jyJQvxgo8kfMpL/iQsq+qGxH3MBiiK6GYGyOxk1LrKmjfIEwD55tOXE hvH3+gOgeMsu0ggyuHc4uyTbGG3+ntl1OWjS57UdFplrDcY0CQPdLW068Vortkq/YG5JB4 bEZ+cdODdc+d35nzNSshi1n00HVo+MA= X-MC-Unique: J9O8QP6uMCq5OHOKVsdWRQ-1 X-Mimecast-MFC-AGG-ID: J9O8QP6uMCq5OHOKVsdWRQ_1760464492 To: devel@lists.libvirt.org Subject: [PATCH] conf: never reject overrides Date: Tue, 14 Oct 2025 13:54:31 -0400 Message-ID: <2f467b259f5ce4a291d4f0536e667d2ab949b13c.1760464434.git.crobinso@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pLPDMLr6G8lSKFIgYcUkMaRDl-MIjeQGDFr1sCwg-X4_1760464492 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZLE5YRREHUJRUB5EWZIRSJZEOY3CRJKV X-Message-ID-Hash: ZLE5YRREHUJRUB5EWZIRSJZEOY3CRJKV X-MailFrom: crobinso@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 CC: Cole Robinson 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: Cole Robinson via Devel Reply-To: Cole Robinson X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1760464590332154100 Content-Type: text/plain; charset="utf-8" Trying to disable for the whole and _also_ disable at the level will fail with: error: unsupported configuration: label overrides require relabeling to b= e enabled at the domain level which seems wrong. Instead skip the validation when disk seclabel has relabel=3D'no', that config should always be valid. Signed-off-by: Cole Robinson --- src/conf/domain_validate.c | 5 +++ ...l-selinux-none-override.x86_64-latest.args | 35 +++++++++++++++ ...el-selinux-none-override.x86_64-latest.xml | 43 +++++++++++++++++++ .../seclabel-selinux-none-override.xml | 30 +++++++++++++ tests/qemuxmlconftest.c | 1 + 5 files changed, 114 insertions(+) create mode 100644 tests/qemuxmlconfdata/seclabel-selinux-none-override.x8= 6_64-latest.args create mode 100644 tests/qemuxmlconfdata/seclabel-selinux-none-override.x8= 6_64-latest.xml create mode 100644 tests/qemuxmlconfdata/seclabel-selinux-none-override.xml diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 93a2bc9b01..eea9b38b21 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -303,6 +303,11 @@ virSecurityDeviceLabelDefValidate(virSecurityDeviceLab= elDef **seclabels, for (i =3D 0; i < nseclabels; i++) { seclabel =3D seclabels[i]; =20 + /* relabel=3D'no' is always valid to request, regardless of + * domain level config */ + if (!seclabel->relabel) + continue; + /* find the security label that it's being overridden */ for (j =3D 0; j < nvmSeclabels; j++) { if (STRNEQ_NULLABLE(vmSeclabels[j]->model, seclabel->model)) diff --git a/tests/qemuxmlconfdata/seclabel-selinux-none-override.x86_64-la= test.args b/tests/qemuxmlconfdata/seclabel-selinux-none-override.x86_64-lat= est.args new file mode 100644 index 0000000000..23beb54806 --- /dev/null +++ b/tests/qemuxmlconfdata/seclabel-selinux-none-override.x86_64-latest.ar= gs @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Doff \ +-accel tcg \ +-cpu qemu64 \ +-m size=3D219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","read-only":false}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-stor= age","id":"ide0-0-0","bootindex":1}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/seclabel-selinux-none-override.x86_64-la= test.xml b/tests/qemuxmlconfdata/seclabel-selinux-none-override.x86_64-late= st.xml new file mode 100644 index 0000000000..15049a8a32 --- /dev/null +++ b/tests/qemuxmlconfdata/seclabel-selinux-none-override.x86_64-latest.xml @@ -0,0 +1,43 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + +
+ + +
+ + +
+ + + + +