From nobody Fri Apr 26 15:36:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506117668817932.7478061243564; Fri, 22 Sep 2017 15:01:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6966D883BE; Fri, 22 Sep 2017 22:01:06 +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 B42B25C54A; Fri, 22 Sep 2017 22:01:05 +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 784491806100; Fri, 22 Sep 2017 22:01:03 +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 v8MLFwFJ018098 for ; Fri, 22 Sep 2017 17:15:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A8545C891; Fri, 22 Sep 2017 21:15:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 567D765EB8 for ; Fri, 22 Sep 2017 21:15:56 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 362014E4C8 for ; Fri, 22 Sep 2017 21:15:55 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Fri, 22 Sep 2017 15:15:52 -0600 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6966D883BE Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6966D883BE DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 362014E4C8 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfehlig@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 362014E4C8 From: Jim Fehlig To: libvir-list@redhat.com Date: Fri, 22 Sep 2017 15:15:30 -0600 Message-Id: <20170922211530.10413-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 22 Sep 2017 21:15:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 22 Sep 2017 21:15:55 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: agx@sigxcpu.org, stefan.bader@canonical.com Subject: [libvirt] [PATCH V2] apparmor: support ptrace checks 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 22 Sep 2017 22:01:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Kernel 4.13 introduced finer-grained ptrace checks https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/com= mit/?h=3Dv4.13.2&id=3D290f458a4f16f9cf6cb6562b249e69fe1c3c3a07 With kernel 4.13 and apparmor 2.11, simply starting libvirtd results in the following apparmor denial type=3DAVC msg=3Daudit(1506112085.645:954): apparmor=3D"DENIED" operation=3D"ptrace" profile=3D"/usr/sbin/libvirtd" pid=3D6984 comm=3D"libvirtd" requested_mask=3D"trace" denied_mask=3D"trace" peer=3D"unconfined" Attempting to start an unconfined domain results in type=3DAVC msg=3Daudit(1506112301.227:1112): apparmor=3D"DENIED" operation=3D"ptrace" profile=3D"/usr/sbin/libvirtd" pid=3D7498 comm=3D"libvirtd" requested_mask=3D"trace" denied_mask=3D"trace" peer=3D"/usr/sbin/libvirtd" And attempting to start a confined domain results in type=3DAVC msg=3Daudit(1506112631.408:1312): apparmor=3D"DENIED" operation=3D"open" profile=3D"virt-aa-helper" name=3D"/etc/libnl/classid" pid=3D8283 comm=3D"virt-aa-helper" requested_mask=3D"r" denied_mask=3D"r" fsuid=3D0 ouid=3D0 type=3DAVC msg=3Daudit(1506112631.530:1319): apparmor=3D"DENIED" operation=3D"open" profile=3D"virt-aa-helper" name=3D"/etc/libnl/classid" pid=3D8289 comm=3D"virt-aa-helper" requested_mask=3D"r" denied_mask=3D"r" fsuid=3D0 ouid=3D0 type=3DAVC msg=3Daudit(1506112632.186:1324): apparmor=3D"DENIED" operation=3D"ptrace" profile=3D"/usr/sbin/libvirtd" pid=3D8342 comm=3D"libvirtd" requested_mask=3D"trace" denied_mask=3D"trace" peer=3D"libvirt-66154842-e926-4f92-92f0-1c1bf61dd1ff" Add ptrace rules to allow the trace operations. Resolves: https://bugzilla.suse.com/show_bug.cgi?id=3D1058847 Signed-off-by: Jim Fehlig --- examples/apparmor/usr.sbin.libvirtd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sb= in.libvirtd index acb59e071..6088db294 100644 --- a/examples/apparmor/usr.sbin.libvirtd +++ b/examples/apparmor/usr.sbin.libvirtd @@ -37,6 +37,10 @@ network packet dgram, network packet raw, =20 + ptrace (trace) peer=3Dunconfined, + ptrace (trace) peer=3D/usr/sbin/libvirtd, + ptrace (tace) peer=3D(label=3D@{profile_name}), + # Very lenient profile for libvirtd since we want to first focus on conf= ining # the guests. Guests will have a very restricted profile. / r, --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list