From patchwork Mon Oct 7 21:49:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 175439 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4853566ill; Mon, 7 Oct 2019 14:58:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuH5k3Pl9LIQtr8cwiZkAdB4wADuFokFyVpo8K4k92iO31JvcejXO5YYb9RXNlh4jpsxt3 X-Received: by 2002:a6b:9109:: with SMTP id t9mr24653346iod.16.1570485515288; Mon, 07 Oct 2019 14:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570485515; cv=none; d=google.com; s=arc-20160816; b=aGPTIZ62qANcdaBJcxKSNRfxooZNfhe01xOGF59QMEX90O+ZIJJ9IJhsDdBqMVq/of kzRSybgnhORHwXLKODTwREtswTiJfj3hKWsV6ZTYJeCxhvXQXxXWQsm+TQtyvgKUOv9T xagExHTl1OKKxLHDodlIabEp7uUgmBaIC+Jn0Wz8u2mST4VsKoPKMmiTQMtVi8sm77zk C7770QrV18yQj/welQSuOMHfetGGhUY8caRe52qvx+ekblRVWGcY26ui9T0FBU+oC6iN uXzSzGyxJ8MDR/rqV2dT0wtunOdD9+2eOuSYcvf7ZiTc+y1nNp6h6dYxnjy54+0PLaXt ZnIw== 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=0X48Fst6Y+m7zz9JriavALw3y9RJkGk65jT/gidieoA=; b=E8KKMtcqrkckRiyxmRJVDzuYCNRz/JOBHMDeGgVVLTGVlqLl1RnTBURo9K5ow2EQUP N3jiJKvvQ5e6bwEymNcDfPQWrtVbppzAf0r87ElgLM8jxOv460qqsBXNAnOs2AKcFEGA 8DjeQLPjBkZ/4HrT1tL9KTc7klkggQ2XJSSw/w/zslA47mP/LXbrUB589y0xv9j1wBl9 qY8xssWr9RehDEZl1PgvWqCTh63MSgnHWlz2Ub9XroTDUIod6bD8JqRAQYBpPybPblf8 OXtEJPl1wfczPOrYyrKQQTnZqx46VXQUgmSAPk7yNZVRF2yOzY1JR5CtwRueLJoxNZx/ 29vw== 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 u11si16335894iom.109.2019.10.07.14.58.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 14:58:35 -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-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0F2964457; Mon, 7 Oct 2019 21:58:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95FC360A35; Mon, 7 Oct 2019 21:58:33 +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 032284EE97; Mon, 7 Oct 2019 21:58:32 +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 x97LosuW015155 for ; Mon, 7 Oct 2019 17:50:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id F03125C224; Mon, 7 Oct 2019 21:50:54 +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 933CB5C1D4; Mon, 7 Oct 2019 21:50:54 +0000 (UTC) From: Cole Robinson To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 17:49:38 -0400 Message-Id: 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 24/30] security: dac: Label externalDataStore 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 07 Oct 2019 21:58:34 +0000 (UTC) We mirror the labeling strategy that was used for its sibling image Signed-off-by: Cole Robinson --- src/security/security_dac.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 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_dac.c b/src/security/security_dac.c index 326b9b1a3c..2bbf773dd3 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -882,7 +882,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr, virSecurityDeviceLabelDefPtr parent_seclabel = NULL; virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); bool remember; - bool is_toplevel = parent == src; + bool is_toplevel = parent == src || parent->externalDataStore == src; uid_t user; gid_t group; @@ -946,6 +946,14 @@ virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr, if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0) return -1; + if (n->externalDataStore && + virSecurityDACSetImageLabelRelative(mgr, + def, + n->externalDataStore, + parent, + flags) < 0) + return -1; + if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN)) break; }