From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Selvin Xavier <selvin.xavier@broadcom.com>,
linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com,
kalesh-anakkur.purayil@broadcom.com,
Yousef Alhouseen <alhouseenyousef@gmail.com>
Subject: Re: [PATCH for-rc 1/8] RDMA/bnxt_re: Reject executable mappings of the DBR and toggle pages
Date: Thu, 10 Sep 2026 12:26:51 +0300 [thread overview]
Message-ID: <20260910092651.GP13683@unreal> (raw)
In-Reply-To: <20260909132948.GI2543240@ziepe.ca>
On Wed, Sep 09, 2026 at 10:29:48AM -0300, Jason Gunthorpe wrote:
> On Tue, Sep 08, 2026 at 04:45:53PM +0300, Leon Romanovsky wrote:
> > On Sun, Sep 06, 2026 at 04:06:53PM -0700, Selvin Xavier wrote:
> > > The BNXT_RE_MMAP_DBR_PAGE and BNXT_RE_MMAP_TOGGLE_PAGE cases of
> > > bnxt_re_mmap() hand out kernel pages that userspace is only supposed to
> > > read. VM_WRITE was already rejected, but VM_EXEC was not, so userspace
> > > could map these kernel pages executable. Reject VM_EXEC as well.
> > > Also, return EPERM instead of EFAULT.
> > >
> > > Fixes: 9b66c9af7172 ("RDMA/bnxt_re: Clear VM_MAYWRITE on DBR/toggle page mmap")
> > > CC: Yousef Alhouseen <alhouseenyousef@gmail.com>
> > > Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> > > Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> > > ---
> > > drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > index ccd2702db78b..e39f99434923 100644
> > > --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > @@ -5057,11 +5057,11 @@ int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma)
> > > break;
> > > case BNXT_RE_MMAP_DBR_PAGE:
> > > case BNXT_RE_MMAP_TOGGLE_PAGE:
> > > - /* Driver doesn't expect write access for user space */
> > > - if (vma->vm_flags & VM_WRITE) {
> > > - ret = -EFAULT;
> > > + /* Driver doesn't expect write and exec access for user space */
> > > + if (vma->vm_flags & (VM_WRITE | VM_EXEC)) {
> > > + ret = -EPERM;
> > > } else {
> > > - vm_flags_clear(vma, VM_MAYWRITE);
> > > + vm_flags_clear(vma, VM_MAYWRITE | VM_MAYEXEC);
> >
> > This is an opposite to 10bf13c33450 ("RDMA/mlx5: Remove MAYEXEC flag")
> > commit.
>
> Why did we do that? These MMIO mmap should never be executable
I don't remember the rationale, but if I understood my findings correctly,
clearing VM_MAYEXEC broke memcopy.
Thanks
next prev parent reply other threads:[~2026-09-10 9:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 23:06 [PATCH for-rc 0/8] RDMA/bnxt_re: Fix input validation and lifetime bugs Selvin Xavier
2026-09-06 23:06 ` [PATCH for-rc 1/8] RDMA/bnxt_re: Reject executable mappings of the DBR and toggle pages Selvin Xavier
2026-09-08 13:45 ` Leon Romanovsky
2026-09-09 4:57 ` Selvin Xavier
2026-09-09 13:29 ` Jason Gunthorpe
2026-09-10 9:26 ` Leon Romanovsky [this message]
2026-09-10 13:47 ` Jason Gunthorpe
2026-09-06 23:06 ` [PATCH for-rc 2/8] RDMA/bnxt_re: Detect wrong sge_len passed for inline Selvin Xavier
2026-09-06 23:06 ` [PATCH for-rc 3/8] RDMA/bnxt_re: Validate num_sge in bnxt_re_post_srq_recv() Selvin Xavier
2026-09-06 23:06 ` [PATCH for-rc 4/8] RDMA/bnxt_re: Validate SRQ max_sge at create time Selvin Xavier
2026-09-06 23:06 ` [PATCH for-rc 5/8] RDMA/bnxt_re: Fix rdev lifetime races in suspend/resume/shutdown Selvin Xavier
2026-09-06 23:06 ` [PATCH for-rc 6/8] RDMA/bnxt_re: Fix the PD and DPI table size Selvin Xavier
2026-09-06 23:06 ` [PATCH for-rc 7/8] RDMA/bnxt_re: Use bnxt_ext_stats_supported for counter count selection Selvin Xavier
2026-09-06 23:07 ` [PATCH for-rc 8/8] RDMA/bnxt_re: Check is_in_used before trusting RCFW completion Selvin Xavier
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=20260910092651.GP13683@unreal \
--to=leon@kernel.org \
--cc=alhouseenyousef@gmail.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=jgg@ziepe.ca \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=linux-rdma@vger.kernel.org \
--cc=selvin.xavier@broadcom.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