Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3194230pxb; Mon, 9 Nov 2020 05:18:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaxhRLVQ3JbRGvlOee2y7mdFj80upCYGdtimtZg4M7AMAQnCUTxl9b2Q2pOCUToEJpoZbw X-Received: by 2002:a17:906:5a8f:: with SMTP id l15mr14590067ejq.419.1604927907883; Mon, 09 Nov 2020 05:18:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604927907; cv=none; d=google.com; s=arc-20160816; b=EKMJ3RDvB6OaQ7Bz0hFBb9+zjAjzi3V3pooOIuTgOYzzSoTA9vrzdfyaVvyZEX9xSl mIO5b99Oy8NP2K/orZHJ9PoFGOTWaaBjGwh4DjyItaMmu/Yy0WFiNWi1UrK/oLzFA+TG Qq1xjMb2OLWUAdXOoOuF4ZzVqHjH1t58KEucDvihk4h1766V6iWGrAPBjQeWFmykPjIh 2kmjKYjzGySKYayMQttTVJkruoPTug1U1hD0lEy8xXLCrv9g53oNH1EEhqH9iPV2aahG E4GwhELgPABagP00dl6S9sFHQg1IW73KOBed8507p1kWXRzOv8srXp+gAYEu6wRPD9qq izWA== 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=nHeu0GYUogeL3Kykp6jCchbUFYcIGV3cTXlbiem8LDk=; b=lqBfrJYUA/CNUU3eG/8CdWVACb1cL1sXIsH1pzD3GnlhhIl5JQaUf88wl2pcRqhg9f 2fr8aM1eiKHg1lydzucomNS2bMOJHwxFH/rBXzmrgfoiXVXl9WXizf9DQg9PTZOPTKU9 zgZlzUtAbek/9wQ3HlFmHjIRXAO9HFdTpppmF7BuqqAfh5LawhWPbu4vTDy5sJZHJkfq GwCl3MuPF8UyltENaJYqCRfj8T0EVePB6DsriWK3fQBXBihr1jO4Gr5MEm8DKNtSAAxq WTWLFkhhkbhpA0Wl6lsub/8w1kqWMN/rtx7RCJLeiRnb93z4h/TbWIYyHGwZNmqTfmbp F7kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WjULJi2i; 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 a10si7324661edq.316.2020.11.09.05.18.04; Mon, 09 Nov 2020 05:18:27 -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=WjULJi2i; 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 S1732068AbgKINN5 (ORCPT + 99 others); Mon, 9 Nov 2020 08:13:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:40040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732094AbgKINNx (ORCPT ); Mon, 9 Nov 2020 08:13:53 -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 541422083B; Mon, 9 Nov 2020 13:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927633; bh=O35HR0UOKEnB2eIZHX5AGFalzroTDFfT5tIHonLKRb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WjULJi2iCLAKoHK246BKWAp6LgtfeD/aU53C8N7lorbDrjHzHXhKO0wOy3WiBr3yN ui2Z5ph3+aTgAq4H+8MTUSIihtjsb0Qf8x2U68xVxjAsh9EDhvzvUIV3XyZJFRZJv9 N8P6Yq4nK7MygC6l0b5g+dz/vQnhkG07c5br7hiE= 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.4 54/85] vsock: use ns_capable_noaudit() on socket create Date: Mon, 9 Nov 2020 13:55:51 +0100 Message-Id: <20201109125025.174171988@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125022.614792961@linuxfoundation.org> References: <20201109125022.614792961@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 7bd6c8199ca67..3a074a03d3820 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -621,7 +621,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