Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6261934imu; Mon, 21 Jan 2019 06:03:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN5rqNfj8ORVwHEdgAZFI807burqLXLrwni7e1LQVY2MJpiHl7p+LyXvTIGsY1xgegQoyzgm X-Received: by 2002:a62:44d8:: with SMTP id m85mr30152286pfi.164.1548079380035; Mon, 21 Jan 2019 06:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079380; cv=none; d=google.com; s=arc-20160816; b=A/Itqk4ANaWymAY8fDWbJHY1lm93Hm565DjKCBfJa9k7J6rKpTWOiwyg8R0m9AoqxS zdRMDXghkq9We9GlYmftHVgvcXf03nNV7TqjwtPR640sWs9uLzLJ+Z7eXegSsjGtZ/f3 X3Yg+Td7zyPqLfdEeL+gEp8lI2d10pI0FAYZ5nDSACHDK2tF6t7LdAwoeoukfwRcJbzT W0o9bywTf00XNuoyBeCIMcz0tF6O5reJ7smQOeH3Xdpr41a/WjDOQz3St5FCS14beqS8 6YXKW2WLenp6jKr57bqEP+2BYEHs0qch95NQb2Qco9lSSb+2WitFO2Qdcv8k6tSWWSQn Z1jQ== 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=6Q4tq00+Ux61wqg9gR0KoZlobHC8X6mc4EX2clIz16E=; b=wXVDj6oKVqNjv6JC4z1K+G4D77etZ3pPTtb6BGuyG2urzRqVbxnLdarK7D/O/UGh8f B8N2IqpPDq58UHEnA+HFfhY+sVhlZ9D6n/YGXi42G7tv9N63MQq8iFtvC/1db40ujK3E eiQffMDZoQb3MmdW1wAGjNO7JZAfKp/YuvODD0AiGaZ0rEBBSSd/AQBXhcvT8hPFGxxY WR6yB3u5+jrXx4ly1/q+4mBoSnRmrYf1sTrM6g5xWYaTBpHH/ko0teXAqOzCkXkT9QAa pnuDvTX/WDY+fad5ve21pKBFYiXNOGOjndvSjqiAieRZ7TFNUx5Yg279NN0AkbsG/1gd U0tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VQg7u5J+; 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 v7si12590430plo.12.2019.01.21.06.02.36; Mon, 21 Jan 2019 06:03:00 -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=VQg7u5J+; 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 S1731471AbfAUOAa (ORCPT + 99 others); Mon, 21 Jan 2019 09:00:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:46998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731177AbfAUOA0 (ORCPT ); Mon, 21 Jan 2019 09:00:26 -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 8DE5720989; Mon, 21 Jan 2019 14:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079226; bh=tCjgMzj6AiwFU8hfkJbWpyW2aYJKDn+0+UrsxBF2Qmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VQg7u5J+SA2idwFOfpcbK4Lll1p4LzUu9FozfDGZul1x1yp+PNQfyTllsrZ4p+ymV OxF2t/4orgo3WN9T9FTMne5T9KhpgrFI0YF9Q8hjg6pY98qPRd3r9ueDcd5v43ZMD1 XPZM2S63M/xxCkazpZrgv1v2TRRnms7tHcuMcDnM= 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.19 52/99] RDMA/nldev: Dont expose unsafe global rkey to regular user Date: Mon, 21 Jan 2019 14:48:44 +0100 Message-Id: <20190121134915.958010656@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-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 @@ -579,10 +579,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;