Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3207019pxb; Mon, 9 Nov 2020 05:36:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhHZRIyXoFzCmqWx0WLng6CqtbmHRY9f22gxKY5laRbcV44wc0N91s+DN3K51DXxXAxsLx X-Received: by 2002:a50:9518:: with SMTP id u24mr15935001eda.124.1604928971927; Mon, 09 Nov 2020 05:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928971; cv=none; d=google.com; s=arc-20160816; b=fCjE3ksGuEQ8Pq1SmA9JfWhiFIBt+4LHaHTwc+mp7HCEV/gqn6z2nM8XP3TPRBUh8r dYM8k5wwACdmq6tgLtHL6xWEgZy9/2yF0bghT83+IDv06sQBWeZP55ECBCUQ0nKJdE+p 1b9JjkWIsa6mj0SrJi/bSRSKzLmyF+1mlciEGcMpcCrnoADVh18IwxiItOLdA6Q9VKOd V4cYtKRXxY4te4fK8nvf4EwPqZSDIHmTlOUUeXS0P8DZDQpf+d33WlMGcZw3Fcm+C/U6 6Kf4MHblreIB2aeeRDSFhc4tZVeU7QxoAdSFl1Qn1ZmnEjNFH3vxqluQuzEt/wM7LjbG woqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WHJSSaKuC+Bkq6Z1G8Ix7/i/0GP2gQBc5n9iB91knHU=; b=T3KYRVjyp0ocbdja2Rkn9Qjk+szNaw0atfFI4sIu6wJYQdAZb3szDtxqIXl0S2CCPA nrBkLDx4kxKyi20tXa3h+PBNGkNQLnCZ+l4hMC48GVUL3l+Od5NBQ3cgSZZraU+dN58S Ds93eVKXbuTnaeRm6C5eQRKmL7C3XYScSq/HYIO3efcTjf/9opjsa5v9rVunm2nMxGUE lXnFwr6ZTmyB4br68a1kVFFS12zjs0PenzjfKq6r7YbM7qforFZw/IsF3B+rpLz54icL C7Q6N5YjeIOwrO40BzG8oTcneojRAUMu67wLm/GWnvk9IEYgHMtWNhPUt18bLFn3SfpM oWrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YItoeg6i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 93si2443297edm.34.2020.11.09.05.35.48; Mon, 09 Nov 2020 05:36:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YItoeg6i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730911AbgKINFs (ORCPT + 99 others); Mon, 9 Nov 2020 08:05:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:57712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730742AbgKINEs (ORCPT ); Mon, 9 Nov 2020 08:04:48 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5922B2076E; Mon, 9 Nov 2020 13:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927087; bh=jHAkwn8opXnjq+jDsnc8Nh3H/Vnp9DiwlCbcaongwUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YItoeg6iRXrDFhAJ4hAPgH2duD+ntV7tDfJyBxmpXpJ52QBL+GdQSQ60/XvQNjpWv RpJOH8FsIgXHMVPgXnaWumB5coZgfmqWcOg457+ccMeSX6xVAHzb0Opn7UL4X/MEgs az1Qfb5KwlFw/ZBQHKTBDyuECbHAU2u4GJD9nXUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Kiryanov , Jeff Vander Stoep , James Morris , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.9 106/117] vsock: use ns_capable_noaudit() on socket create Date: Mon, 9 Nov 2020 13:55:32 +0100 Message-Id: <20201109125030.729066386@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeff Vander Stoep [ Upstream commit af545bb5ee53f5261db631db2ac4cde54038bdaf ] During __vsock_create() CAP_NET_ADMIN is used to determine if the vsock_sock->trusted should be set to true. This value is used later for determing if a remote connection should be allowed to connect to a restricted VM. Unfortunately, if the caller doesn't have CAP_NET_ADMIN, an audit message such as an selinux denial is generated even if the caller does not want a trusted socket. Logging errors on success is confusing. To avoid this, switch the capable(CAP_NET_ADMIN) check to the noaudit version. Reported-by: Roman Kiryanov https://android-review.googlesource.com/c/device/generic/goldfish/+/1468545/ Signed-off-by: Jeff Vander Stoep Reviewed-by: James Morris Link: https://lore.kernel.org/r/20201023143757.377574-1-jeffv@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/vmw_vsock/af_vsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index d6473b8d9a81a..3a2543b9701a9 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -651,7 +651,7 @@ struct sock *__vsock_create(struct net *net, vsk->owner = get_cred(psk->owner); vsk->connect_timeout = psk->connect_timeout; } else { - vsk->trusted = capable(CAP_NET_ADMIN); + vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN); vsk->owner = get_current_cred(); vsk->connect_timeout = VSOCK_DEFAULT_CONNECT_TIMEOUT; } -- 2.27.0