From patchwork Tue Dec 10 00:55:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 181100 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp5102475ile; Mon, 9 Dec 2019 16:54:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxXL6D4v5iNk7t8q2OONaAu7DUyNN4CK9jtkioz49N9vOmbFKo8QLxXCME5LLn5hjv5v7Nl X-Received: by 2002:a17:906:3953:: with SMTP id g19mr712802eje.227.1575939262642; Mon, 09 Dec 2019 16:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575939262; cv=none; d=google.com; s=arc-20160816; b=tZQ9vAHauWGTScq6Xu2zMMzG0GT1bbvk9mbuB+k2f+hYKOgcFxdMAhAeNA9T+A1RjX O1nFph0VgG3xin6X80zVqWCzO2UwWH1GVINWxsjYfAe1LrI7VO0YO0PHfOBdmrnkJQNc Tjyhb7tNt00faFRcRiZkZBoQgK7GrAUECWzlhASeYsy+rNYHR9D+tYiU5YX+LnX36v85 2y6uZBdoaXTEQyHu744Df7ePz7yYOapv9TzjEPAORkRE4pC0WeecYM7AAOoCAX4swZwu E2+39heMN7ayxuTQ9uGjSyj+Hu15QxAMTlzYhEirPoz/yol7GOcHz8tXibESu4h3imRN MZ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:errors-to:sender:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:delivered-to:dkim-signature; bh=0VuZl3WznRQDDZsc2ZjLuK8/k8c8qL2XVAL1sNa2usY=; b=Mruc1JE13RzHfu5sFuXc7F7P1tf4EoioxyB5UMu7wOUEIuFPYiL8aP5RmI3iYKUGsZ 9LlUE/OhLaydon64VLUj6xUhb6I9K/7rWcC3CT05xl7JrJ2gUZ/iTYyAccKGs6/YaUii lkTkTLWdajYiE5sW9IPps7wyiNiG12SDqMOU+Q+Lf0k0GrJPW/m7Xg+PpsEOeJbeSqdA vd55cW3FonUrDKyXHP0JdyEjJLZ3ZceadUVq5sieSXFNOC1sFBOWiH6hh5Up9SMMaJRK Bes+WD1eRo3SZAP5LE5hYQJyJRz+yt/gdLk+gb1sM5Cwr7d8AVRkAYpkgjtzWZwwsi0w rPlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gW2gx5YM; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 207.211.31.81 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 us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com. [207.211.31.81]) by mx.google.com with ESMTPS id dn15si950431edb.218.2019.12.09.16.54.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Dec 2019 16:54:22 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gW2gx5YM; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575939261; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0VuZl3WznRQDDZsc2ZjLuK8/k8c8qL2XVAL1sNa2usY=; b=gW2gx5YM64kjxD775ZFyqr9wF6clkHtgk1sn5dDrJOky6pMR5sk9ojvVROYXwzM64bL1Wk ZtLLdrjoc4okkdl/p8LVZkQyBzCkWdhGipGUqfLhEQv0L9yz1cY5YPDnM4siJHwZLLpL24 TS78rJHhhvU6k03/jzXudqkzK3n7tjI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-sorPMLDOOdyVlOW-AeZJ8A-1; Mon, 09 Dec 2019 19:54:20 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 788891804485; Tue, 10 Dec 2019 00:54:14 +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 3B8501001B0B; Tue, 10 Dec 2019 00:54:13 +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 246681809567; Tue, 10 Dec 2019 00:54:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBA0s5oB014608 for ; Mon, 9 Dec 2019 19:54:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6A4C56E3F9; Tue, 10 Dec 2019 00:54:05 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-122-221.rdu2.redhat.com [10.10.122.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9814AA4B84; Tue, 10 Dec 2019 00:54:01 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 9 Dec 2019 19:55:17 -0500 Message-Id: <69c33aac22f5911bb800fe41b62e704fe24cd4ce.1575939270.git.crobinso@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: christian.ehrhardt@canonical.com, Cole Robinson Subject: [libvirt] [PATCH v2] security: apparmor: 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.84 on 10.5.11.22 X-MC-Unique: sorPMLDOOdyVlOW-AeZJ8A-1 X-Mimecast-Spam-Score: 0 Teach virt-aa-helper how to label a qcow2 data_file, tracked internally as externalDataStore. It should be treated the same as its sibling disk image Signed-off-by: Cole Robinson --- v2: s/src/tmp/ src/security/virt-aa-helper.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Christian Ehrhardt Signed-off-by: Cole Robinson <crobinso@redhat.com>

Now LGTM, thanks for the rework.
And after Peters explanation (thanks) I agree that it is the right approach to do it inside the loop.

Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
 
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index c93dddb228..f623ff965f 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -918,6 +918,10 @@ storage_source_add_files(virStorageSourcePtr src, if (add_file_path(tmp, depth, buf) < 0) return -1; + if (tmp->externalDataStore && + storage_source_add_files(tmp->externalDataStore, buf, depth) < 0) + return -1; + depth++; }