Return-Path: Received: from bombadil.infradead.org ([198.137.202.9]:45001 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbbGKKRy (ORCPT ); Sat, 11 Jul 2015 06:17:54 -0400 Date: Sat, 11 Jul 2015 03:17:36 -0700 From: "'Christoph Hellwig'" To: Jason Gunthorpe Cc: Tom Talpey , Doug Ledford , "'Christoph Hellwig'" , Sagi Grimberg , Steve Wise , sagig@mellanox.com, ogerlitz@mellanox.com, roid@mellanox.com, linux-rdma@vger.kernel.org, eli@mellanox.com, target-devel@vger.kernel.org, linux-nfs@vger.kernel.org, trond.myklebust@primarydata.com, bfields@fieldses.org, Oren Duer Subject: Re: [PATCH V3 1/5] RDMA/core: Transport-independent access flags Message-ID: <20150711101736.GA14741@infradead.org> References: <20150708190842.GB11740@obsidianresearch.com> <20150708203205.GA21847@infradead.org> <20150709000337.GE16812@obsidianresearch.com> <559EF332.7060103@redhat.com> <20150709225306.GA30741@obsidianresearch.com> <559FC710.1050307@talpey.com> <20150710161108.GA19042@obsidianresearch.com> <55A00754.4010009@redhat.com> <55A01225.9000000@talpey.com> <20150710195420.GA31500@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20150710195420.GA31500@obsidianresearch.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: On Fri, Jul 10, 2015 at 01:54:20PM -0600, Jason Gunthorpe wrote: > diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c > index bac3fb406a74..6ed7e0f6c162 100644 > --- a/drivers/infiniband/core/verbs.c > +++ b/drivers/infiniband/core/verbs.c > @@ -1126,6 +1126,12 @@ struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags) > struct ib_mr *mr; > int err; > > + /* Granting remote access to the physical MR is a security hole, don't > + do it. */ > + WARN_ON_ONCE(mr_access_flags & > + (IB_ACCESS_REMOTE_WRITE | IB_ACCESS_REMOTE_READ | > + IB_ACCESS_REMOTE_ATOMIC)); > + How about providing a system-wide IB_ACCESS_LOCAL_READ | IB_ACCESS_LOCAL_WRITE MR that all drivers can use and get rid of ib_get_dma_mr in the long run? That would help to nicely simplify drivers? Currently various drivers are using ib_get_dma_mr with remote flags unfortunately, e.g. the SRP initiator driver uses it to optimize away memory registrtions for single SGL entry requests. That looks fixable realtively easily, but I don't understand the other consumers as good.