[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190416110730.32230-4-leon@kernel.org>
Date: Tue, 16 Apr 2019 14:07:27 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...lanox.com>
Cc: Leon Romanovsky <leonro@...lanox.com>,
RDMA mailing list <linux-rdma@...r.kernel.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Feras Daoud <ferasda@...lanox.com>,
Haggai Eran <haggaie@...lanox.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Saeed Mahameed <saeedm@...lanox.com>,
linux-netdev <netdev@...r.kernel.org>
Subject: [PATCH rdma-next 3/6] RDMA/ucontext: Do not allow BAR mappings to be executable
From: Jason Gunthorpe <jgg@...lanox.com>
These are not code pages and should never be executed.
Cc: stable@...r.kernel.org
Fixes: 5f9794dc94f5 ("RDMA/ucontext: Add a core API for mmaping driver IO memory")
Signed-off-by: Jason Gunthorpe <jgg@...lanox.com>
Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
---
drivers/infiniband/core/uverbs_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index fef4519d1241..3ef6474cd201 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -889,6 +889,10 @@ static struct rdma_umap_priv *rdma_user_mmap_pre(struct ib_ucontext *ucontext,
struct ib_uverbs_file *ufile = ucontext->ufile;
struct rdma_umap_priv *priv;
+ if (vma->vm_flags & VM_EXEC)
+ return ERR_PTR(-EINVAL);
+ vma->vm_flags &= ~VM_MAYEXEC;
+
if (vma->vm_end - vma->vm_start != size)
return ERR_PTR(-EINVAL);
--
2.20.1
Powered by blists - more mailing lists