Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3197619pxb; Mon, 9 Nov 2020 05:23:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqWGhJKitAKvvXTsHRowsvFnpgHzrsSbmuNOACwSMm65fLTfAMn66QniaReonNSwP+sR6a X-Received: by 2002:aa7:de95:: with SMTP id j21mr15802718edv.199.1604928186021; Mon, 09 Nov 2020 05:23:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928186; cv=none; d=google.com; s=arc-20160816; b=rv6gOJkmdtYpn9Eq+6S9nZYLGW09+kVr2eCAC4ofFrXJyJvBsXtksH09pLZe+uC/qd s/TAYh5QCY7wKksemnRLWH1MN4h86J9sNNiDwsa1waBo1BNg/6fYpwp4VWvfJ0LuFSoJ WBSLangXC5rNzA9cJkgy5t6EMJqkRcqvjjfKaIvDh47DLIq2qmia4jdXVFstylnL6yjE xaYJsGEIjMbht+3LZh07JrENh17nXpaLenlutNrIDiBJAdb6VAAa1SYoSTG1xcjHMytC 50P6aD2hbJWu//fPY6NUYh0RDFmOHsEzFLTZeIpN4mXHtzUup/orE0fUb8z46TnXS+uG l3sQ== 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=/E1KJT6aorbvDCLa29MqDsxExmaWYSkFhrE14cs4+g8=; b=R4l+G3KjHSGS6iLOI3YdjR4bCoDWNJlh+CF6+7+yh/X9KGeKUDF5o+WAbet7wW344R K4pHCZFYcESm78NxBNxZ/umPEU2Jpg5vaW//I+5Xax4iu/iscoM1cEXbWcHSXWkIMYw1 DL6kyfCBPQem0r5BaMfnN7/u6Kh1fAJdrV986vKDTw8ljgnYfaFGb8nH2SNu3XJnCPkR XuBDbY1qzt5ZkGBng8SpiD70MGYTmSZWY599nZwU9+E6juuoMv2XyokdOaJdC1JXJMqj 2+S+feXLBM/eK2g6E84198cplSJswjhtR4Ct5u6EWq3s7d6x8sSiK4ky6reoNKY3ARtn iWaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="DvSbN/ZE"; 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 b21si7904762ejz.183.2020.11.09.05.22.41; Mon, 09 Nov 2020 05:23:06 -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="DvSbN/ZE"; 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 S2387652AbgKINUa (ORCPT + 99 others); Mon, 9 Nov 2020 08:20:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:48046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730884AbgKINU2 (ORCPT ); Mon, 9 Nov 2020 08:20:28 -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 099BB20663; Mon, 9 Nov 2020 13:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928027; bh=y/gsWimhlOriT2iB0GGb7doP5K83/bg3yp/dF94Ay/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvSbN/ZEnckg+dhdYtFp6trd2trjnbnjvjW+UorXlG/0LRulOc1VeXGpwgwIh6yaL /K5THAK/0+mkh/HRwgp3Hbb1maC2WJA64a2dNO0AvocyAbiG9+qJEEbFg4MbW2TJJe OElS2Z0RY9Ezzlnv5/jdcqLWbqDWzWNruuGlzNGA= 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 5.9 095/133] vsock: use ns_capable_noaudit() on socket create Date: Mon, 9 Nov 2020 13:55:57 +0100 Message-Id: <20201109125035.268486670@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@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 9e93bc201cc07..b4d7b8aba0037 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -739,7 +739,7 @@ static struct sock *__vsock_create(struct net *net, vsk->buffer_min_size = psk->buffer_min_size; vsk->buffer_max_size = psk->buffer_max_size; } 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; vsk->buffer_size = VSOCK_DEFAULT_BUFFER_SIZE; -- 2.27.0