From nobody Mon Feb 9 06:34:01 2026 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=1673266806; cv=none; d=zohomail.com; s=zohoarc; b=itD4uqnkXhcV91bwAlByjIA1y/CXZ0X+ywyNhuLGOe/4ukqQOAYAeOcUo6arrewu0Jzq6cbMlrwRbatlSnfvMfolvJJyC/kkCvb3zMR6XVbjENXIZXrcmP2W+W2BsA6mydr+JwDMIuXGsPVWJvFqliMekSo5+G9+cpb8AzjiJ00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673266806; h=Content-Type:Content-Transfer-Encoding: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=gG9xW03YFX52yFrczEd9/bkBjbtfL/M8TSUCCd06THg=; b=JpOE8mAIZE09qbQH7xFXWmhNvehCcD8G94gNUwVELwWUnW20BkpAiUPwZA/mulMpMxwhJ4K20pgr48Hg4G2IH9Bm1hpR2LJlpJTSgMDeoU4GzDuBzdIjF/QVOW5O8iSy1RvQG+7rRVjyCNykLdjsGQuXBw/AFrlDaJ431eXbzYU= 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 1673266806270890.5833561591484; Mon, 9 Jan 2023 04:20:06 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-196-CgMXnLTPPsacpStNcLUziQ-1; Mon, 09 Jan 2023 07:19:12 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3BD1F85CBF9; Mon, 9 Jan 2023 12:19:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 279D32026D2A; Mon, 9 Jan 2023 12:19:10 +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 13CE41947BA3; Mon, 9 Jan 2023 12:19:10 +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 BCD781947B90 for ; Mon, 9 Jan 2023 12:19:08 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B15FE4014CE2; Mon, 9 Jan 2023 12:19:08 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-20.brq.redhat.com [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1EE4C401530E for ; Mon, 9 Jan 2023 12:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673266805; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gG9xW03YFX52yFrczEd9/bkBjbtfL/M8TSUCCd06THg=; b=CvIZaXHoKANfYM0Qe4Qcv5DVYFkoq1IvOckXta01RN9z4eO8EKkThDsNImKRluvqu1BGVs gS8LIEcFtLP78MQzbgcwKjbDExWFQgA8m1Ah7aYVQUyWpJLYcksSPfk8cOYSE+hlhQHQbL LGfUeNw791K3V0GccMSSl3D8z/aXkVg= X-MC-Unique: CgMXnLTPPsacpStNcLUziQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 11/17] secuirity: DAC: Don't relabel FD-passed virStorageSource images Date: Mon, 9 Jan 2023 13:18:49 +0100 Message-Id: <4267be78bb8b7f17ad1bb785982f8d413e25a214.1673266652.git.pkrempa@redhat.com> In-Reply-To: References: 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1673266807369100007 Content-Type: text/plain; charset="utf-8" DAC security label is irrelevant once you have the FD. Disable all labelling for such images. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/security/security_dac.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 917fcf76a3..4036a2c27a 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -881,6 +881,10 @@ virSecurityDACSetImageLabelInternal(virSecurityManager= *mgr, if (!priv->dynamicOwnership) return 0; + /* Images passed via FD don't need DAC seclabel change */ + if (virStorageSourceIsFD(src)) + return 0; + secdef =3D virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME); if (secdef && !secdef->relabel) return 0; @@ -992,6 +996,10 @@ virSecurityDACRestoreImageLabelSingle(virSecurityManag= er *mgr, if (src->readonly || src->shared) return 0; + /* Images passed via FD don't need DAC seclabel change */ + if (virStorageSourceIsFD(src)) + return 0; + secdef =3D virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME); if (secdef && !secdef->relabel) return 0; @@ -1112,10 +1120,14 @@ virSecurityDACMoveImageMetadata(virSecurityManager = *mgr, if (!priv->dynamicOwnership) return 0; - if (src && virStorageSourceIsLocalStorage(src)) + if (src && + virStorageSourceIsLocalStorage(src) && + !virStorageSourceIsFD(src)) data.src =3D src->path; - if (dst && virStorageSourceIsLocalStorage(dst)) + if (dst && + virStorageSourceIsLocalStorage(dst) && + !virStorageSourceIsFD(dst)) data.dst =3D dst->path; if (!data.src) --=20 2.38.1