Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6283490imu; Mon, 21 Jan 2019 06:21:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Z4K0zEtkINWnuH91tA3PcMneYU4GStsPJmb3prL0LnythvNLUu/IMZpLcTEEj8IRp9esD X-Received: by 2002:a63:ef47:: with SMTP id c7mr12477120pgk.386.1548080484262; Mon, 21 Jan 2019 06:21:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548080484; cv=none; d=google.com; s=arc-20160816; b=FTB6AvXx16wehDMD92fQBn1XdkN5ZVl/mNJ4+KCThNv1xp5RZU2zrL4WVNAKxHs03/ kFyzkaml5QpXF6MR1sQBRnS0+Wcjhr0ScUCL2jR76/gqnOSpEM2HquLvzLtYI/Wmt3rc UYZStbaru08AMB76wgjqNofu2dm/6r8NUAAWJnEhR1qwV37PlV19fBwlJaOdTzmuoL97 V+D/iyZBoU9ZOuuVp1KNtwuU4SITHudoBrRoKdoAAchFO8f3BhapXVmyxkssooftZrIp OxSW4WNe3glxlUnQ4ZlliRH8ib9QYjEcndFVYOK7iG5K9z5Ni3aj73QngZe9sxUr9Q9O hWkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iN1TIT2VjJBy8JHvEeMMAmO6TWDuT/trICp6jklKYs8=; b=QzcUDKoLqzns6/w+AVwMj8brmZMfM4EJ+S7asIaxpJvg/lodXJSbNFsKaEHGfDn/JN nIjLFwGapQuWwvZ0CLHS8WXtAa60fz5h8pW7x7vU+IHEbsnP9LdyPDeJkJqBCTgewXp6 EYLWSs9GjBRYw6TjN1s/tr5FFXy8REdLIFixsZqR26JXQTKhGS8g4zoFLKQaE+PHuCcN nTEx9w6Im1E2QaKDEiRvmFed6QKbRRWR2zVxXSktvnPxDHcEIWl1lG4cmmVeGCnCniYf EpSlA+1LdYulbU06CHa6BkkUYvzcF4gYTQuP+fAXaE1CQFR0zdkfpGGZ5s1rKBROZAPe 0mxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=crX9BgIG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si13231037pli.432.2019.01.21.06.21.09; Mon, 21 Jan 2019 06:21:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=crX9BgIG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730680AbfAUOTs (ORCPT + 99 others); Mon, 21 Jan 2019 09:19:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:58484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729336AbfAUNsb (ORCPT ); Mon, 21 Jan 2019 08:48:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 53E852063F; Mon, 21 Jan 2019 13:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078510; bh=qM6w4+yzsFLwdNK6g5amleqeNrgmAc3BL76qCAsnCBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=crX9BgIGc7n+RNxqlceE+LpjMU49jqvwL2Gb9+c++FM2eWRCya0P26kR56at1BlRC 3HJfr98IQD8APr0kqtEN98C7UyAsP1GN9wwLrJr+J8ehb3IR8nhpRfWL+YbzwE3oTZ bWybAGQwWMYOmsNDpP7+0L7DjYw7EPGu/h/kxhFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 4.20 058/111] RDMA/nldev: Dont expose unsafe global rkey to regular user Date: Mon, 21 Jan 2019 14:42:52 +0100 Message-Id: <20190121122502.277934697@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leon Romanovsky commit a9666c1cae8dbcd1a9aacd08a778bf2a28eea300 upstream. Unsafe global rkey is considered dangerous because it exposes memory registered for all memory in the system. Only users with a QP on the same PD can use the rkey, and generally those QPs will already know the value. However, out of caution, do not expose the value to unprivleged users on the local system. Require CAP_NET_ADMIN instead. Cc: # 4.16 Fixes: 29cf1351d450 ("RDMA/nldev: provide detailed PD information") Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/nldev.c | 4 ---- 1 file changed, 4 deletions(-) --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c @@ -580,10 +580,6 @@ static int fill_res_pd_entry(struct sk_b if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_USECNT, atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD)) goto err; - if ((pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY) && - nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, - pd->unsafe_global_rkey)) - goto err; if (fill_res_name_pid(msg, res)) goto err;