From patchwork Mon Oct 7 21:49:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 175443 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4853873ill; Mon, 7 Oct 2019 14:58:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxPh//qV7TWCmPIdqWQGUFrzYK/4mKRB2McDUJbViz74PiIrE6+dmVuuHFmfedGhm51jxI X-Received: by 2002:a92:6c10:: with SMTP id h16mr32313590ilc.299.1570485533722; Mon, 07 Oct 2019 14:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570485533; cv=none; d=google.com; s=arc-20160816; b=opL79nUDaNoC5FkeyjVEdEJ9y4ypraigVcO9BXIza1Jlhzs2gu8HH/iv0ulh0CWVHq mrnm6aoJQwbQHeOxmw9Jrsv+L5VUMACGW/8c1Yr/cCoUpgMHr8FKgXUqn2TgWnNUyNAj 4nv8QRhPYGArVcUc/5269dxgHQycQPqDz6TykFl09L0PftRfitvdDNa7IpbOZxIh66rZ uqF9U+OAID9sApRiLcpxw7LCK/ewWu65JZoDhtzx2WDLSoQwCVQmKvulh38YSRgAkVf3 ydzllmCasg5CuYhsKnBqNUHeSCu1elTqRbFmzPJQ33TD1DZ93xifd1IosYxp13UEE6nM e7Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=ldf0gZ9i5zBrJXYGqKNWCRh3osG8wq5WOqaLBq5oCjs=; b=vTzwdCGN5Id9bl5+vAv0vEwbOz/B0oiA4O+CYCIar5JRCephQ4YGMeEFggriB/FzER My+AcC4cUbZI0z5RHv3fo23AHOVcD9wADLXOLnWdSigNn+5PaFaoLeSWlzYlWVr4kOyp 8dMLhg7ZcJNQz/ZwbqekQSg8inniytvf2IvA4akRvspwYoetM/1Kbtr02dLhmISKyLUV 3R+41qeAVEhtpkZZANEjRDa4ZF2ju6N/XWb60f7mNR5I6ohrqXQ7r13AwRGBDNfat6R+ 6Lov5q1CZVWQbHnabWWds6hjgsR/vWHVVdcVp/q6WP0iDopICWeFa6Vdj/fTJLnCw5Xt Bd3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id y19si19240445jad.52.2019.10.07.14.58.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 14:58:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F24210CC1EE; Mon, 7 Oct 2019 21:58:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 696336012D; Mon, 7 Oct 2019 21:58:52 +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 2D3FF1803518; Mon, 7 Oct 2019 21:58:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x97Lovbo015192 for ; Mon, 7 Oct 2019 17:50:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id C626E5C224; Mon, 7 Oct 2019 21:50:57 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from worklaptop.redhat.com (ovpn-123-156.rdu2.redhat.com [10.10.123.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 690005C1D4; Mon, 7 Oct 2019 21:50:57 +0000 (UTC) From: Cole Robinson To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 17:49:43 -0400 Message-Id: <576bd3d5f50ab3cfec37d21e1e9729258838ec7d.1570482718.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 29/30] security: selinux: break out SetImageLabelRelative X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Mon, 07 Oct 2019 21:58:53 +0000 (UTC) This will be used for recursing into externalDataStore Signed-off-by: Cole Robinson --- src/security/security_selinux.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Daniel Henrique Barboza diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index c0bfb581e3..feb703d325 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1919,15 +1919,16 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr, static int -virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src, - virSecurityDomainImageLabelFlags flags) +virSecuritySELinuxSetImageLabelRelative(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + virStorageSourcePtr parent, + virSecurityDomainImageLabelFlags flags) { virStorageSourcePtr n; for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) { - if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, src) < 0) + if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, parent) < 0) return -1; if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN)) @@ -1938,6 +1939,15 @@ virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr, } +static int +virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + virSecurityDomainImageLabelFlags flags) +{ + return virSecuritySELinuxSetImageLabelRelative(mgr, def, src, src, flags); +} + struct virSecuritySELinuxMoveImageMetadataData { virSecurityManagerPtr mgr; const char *src;