From nobody Fri Apr 26 00:05:10 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555343598; cv=none; d=zoho.com; s=zohoarc; b=IL7VxTGXRbw1a/0t5LLCmib07LnfEagilqbmANIn1FGU9fVPtVWl2QIKRPlrPoiJjyBbbvmI86cMFjnpApZQcc9E6F8wBn/c6FyGjRhkoV+jm+z5ZRHciYchj857Zf9MgrOXyNu8/m7VFzdKYtvS4y7WtDNEixOwFGwDhHUv5x4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555343598; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=JPI9pTuVstovKi1n8YaCRawF3aBX/N2HjGpHrXobFhM=; b=kDuP/Z9ZN++nx89ONWVu4j/z3utVSi6TBsh7MT9Bk/p/+mZhhikYHULbImtV6IXcSG2Xk7rcj9NaYx+TYy/QaP1ymtl7cUuqMkg+LBwblhnUrdHQ1bKKHVKgKWQevD64YATuduBA22UU7p5gN5/5Pppex/M+5TnoTwX8Eda2DUs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555343598471760.1234078996847; Mon, 15 Apr 2019 08:53:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06DC833024A; Mon, 15 Apr 2019 15:53:15 +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 7771F19C71; Mon, 15 Apr 2019 15:53:11 +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 BAA863D86; Mon, 15 Apr 2019 15:53:03 +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 x3FFr1GV032473 for ; Mon, 15 Apr 2019 11:53:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6382A608C6; Mon, 15 Apr 2019 15:53:01 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E001C608C2 for ; Mon, 15 Apr 2019 15:52:56 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 17:52:50 +0200 Message-Id: <5e892aa831983b814759a62fd2bd439a93200cff.1555343564.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virSecurityDACRestoreChardevLabel: Restore UNIX sockets too 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 15 Apr 2019 15:53:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We're setting seclabels on unix sockets but never restoring them. Surprisingly, we are in SELinux driver. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/security/security_dac.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 6f8ca8cd54..0adf71bed6 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1457,13 +1457,25 @@ virSecurityDACRestoreChardevLabel(virSecurityManage= rPtr mgr, ret =3D 0; break; =20 + case VIR_DOMAIN_CHR_TYPE_UNIX: + if (!dev_source->data.nix.listen || + (dev_source->data.nix.path && + virFileExists(dev_source->data.nix.path))) { + /* Also label mode=3D'bind' sockets if they exist, + * e.g. because they were created by libvirt + * and passed via FD */ + if (virSecurityDACRestoreFileLabel(mgr, dev_source->data.nix.p= ath) < 0) + goto done; + } + ret =3D 0; + break; + case VIR_DOMAIN_CHR_TYPE_NULL: case VIR_DOMAIN_CHR_TYPE_VC: case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_UDP: case VIR_DOMAIN_CHR_TYPE_TCP: - case VIR_DOMAIN_CHR_TYPE_UNIX: case VIR_DOMAIN_CHR_TYPE_SPICEVMC: case VIR_DOMAIN_CHR_TYPE_SPICEPORT: case VIR_DOMAIN_CHR_TYPE_NMDM: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list