From: Jason Gunthorpe <jgg@nvidia.com>
To: Shiraz Saleem <shiraz.saleem@intel.com>
Cc: <dledford@redhat.com>, <linux-rdma@vger.kernel.org>,
<stable@kernel.org>, Di Zhu <zhudi21@huawei.com>
Subject: Re: [PATCH v1 1/2] RDMA/i40iw: Address an mmap handler exploit in i40iw
Date: Tue, 24 Nov 2020 20:07:26 -0400 [thread overview]
Message-ID: <20201125000726.GG4800@nvidia.com> (raw)
In-Reply-To: <20201124235102.1745-2-shiraz.saleem@intel.com>
On Tue, Nov 24, 2020 at 05:51:02PM -0600, Shiraz Saleem wrote:
> i40iw_mmap manipulates the vma->vm_pgoff to differentiate a push page
> mmap vs a doorbell mmap, and uses it to compute the pfn in remap_pfn_range
> without any validation. This is vulnerable to an mmap exploit as
> described in [1].
>
> Push feature is disabled in the driver currently and therefore no push
> mmaps are issued from user-space. The feature does not work as expected
> in the x722 product.
>
> Remove the push module parameter and all VMA attribute manipulations
> for this feature in i40iw_mmap. Update i40iw_mmap to only allow DB
> user mmapings at offset = 0. Check vm_pgoff for zero and if the mmaps
> are bound to a single page.
>
> [1] https://lore.kernel.org/linux-rdma/20201119093523.7588-1-zhudi21@huawei.com/raw
>
> Fixes: d37498417947 ("i40iw: add files for iwarp interface")
> Cc: stable@kernel.org
> Reported-by: Di Zhu <zhudi21@huawei.com>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> drivers/infiniband/hw/i40iw/i40iw_main.c | 4 ---
> drivers/infiniband/hw/i40iw/i40iw_verbs.c | 37 +++++-----------------------
> 2 files changed, 7 insertions(+), 34 deletions(-)
Please compile your patches:
drivers/infiniband/hw/i40iw/i40iw_main.c: In function ‘i40iw_setup_init_state’:
drivers/infiniband/hw/i40iw/i40iw_main.c:1579:21: error: ‘push_mode’ undeclared (first use in this function); did you mean ‘user_mode’?
1579 | iwdev->push_mode = push_mode;
| ^~~~~~~~~
| user_mode
drivers/infiniband/hw/i40iw/i40iw_main.c:1579:21: note: each undeclared identifier is reported only once for each function it appears in
Jason
next prev parent reply other threads:[~2020-11-25 0:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 23:51 [PATCH v1 0/2] Fix an mmap exploit and remove push in i40iw Shiraz Saleem
2020-11-24 23:51 ` [PATCH v1 1/2] RDMA/i40iw: Address an mmap handler exploit " Shiraz Saleem
2020-11-25 0:07 ` Jason Gunthorpe [this message]
2020-11-25 1:04 ` Saleem, Shiraz
2020-11-24 23:51 ` [PATCH v1 2/2] RDMA/i40iw: Remove push code from i40iw Shiraz Saleem
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201125000726.GG4800@nvidia.com \
--to=jgg@nvidia.com \
--cc=dledford@redhat.com \
--cc=linux-rdma@vger.kernel.org \
--cc=shiraz.saleem@intel.com \
--cc=stable@kernel.org \
--cc=zhudi21@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox