All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: AYS <ays511.kr@gmail.com>,
	zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org,
	security@kernel.org
Subject: Re: [PATCH] RDMA/rxe: validate cur_sge on the receive path before indexing dma->sge[]
Date: Thu, 1 Oct 2026 19:07:37 +0300	[thread overview]
Message-ID: <20261001160737.GR3401365@unreal> (raw)
In-Reply-To: <2026093031-deferral-excitable-9009@gregkh>

On Wed, Sep 30, 2026 at 05:34:55PM +0200, Greg KH wrote:
> On Thu, Oct 01, 2026 at 12:15:52AM +0900, AYS wrote:
> > A user QP's receive queue is an mmap'd ring: the user provider writes the
> > WQEs and post_recv does not touch them, so every field of struct
> > rxe_recv_wqe is attacker controlled. When the responder takes a WQE it
> > validates only dma.num_sge (rxe_get_recv_wqe()/get_srq_wqe()); dma.cur_sge,
> > dma.sge_offset and dma.resid are copied into qp->resp.srq_wqe unchecked.
> > 
> > copy_data() then uses cur_sge as an index immediately --
> > struct rxe_sge *sge = &dma->sge[dma->cur_sge];
> > -- and dereferences it (sge->length) before the in-loop
> > "dma->cur_sge >= dma->num_sge" test, which only runs after the first sge++.
> > cur_sge is a u32, so this reads far out of bounds of the RXE_MAX_SGE-entry
> > dma->sge[] embedded in the kmalloc-2k struct rxe_qp: an information leak (the
> > out-of-bounds sge->length is recoverable through the work-completion status)
> > and a DoS. The send queue already got this check in commit 126c757e4cd4; the
> > receive path did not.
> > 
> > Reject an out-of-range cur_sge in copy_data() before the first sge
> > dereference. This also covers the send retry path and is harmless to the
> > kernel ULP path, which always sets cur_sge = 0.
> > 
> > Fixes: 8700e3e7c485 ("Soft RoCE driver")
> > Signed-off-by: Youngsung Ahn <ays511.kr@gmail.com>
> 
> Does not match the "From:" line :(
> 
> No cc: stable?

No need to CC stable@ on RXE patches; I will remove it when applying them anyway.
Nothing urgent here.

Thanks

> 
> No Assisted-by: line?
> 
> thanks,
> 
> greg k-h
> 

  reply	other threads:[~2026-10-01 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 15:15 [PATCH] RDMA/rxe: validate cur_sge on the receive path before indexing dma->sge[] AYS
2026-09-30 15:34 ` Greg KH
2026-10-01 16:07   ` Leon Romanovsky [this message]
2026-10-01 16:44   ` Zhu Yanjun
  -- strict thread matches above, loose matches on Subject: below --
2026-09-30 18:01 Youngsung Ahn
2026-09-30 18:11 ` sashiko-bot
     [not found] <CAPAqSgYT9torsoAh_UexRewz-uPV9QNzOg1v3TPFxykQSaMJGA@mail.gmail.com>
2026-09-30 19:21 ` Willy Tarreau

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=20261001160737.GR3401365@unreal \
    --to=leon@kernel.org \
    --cc=ays511.kr@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=zyjzyj2000@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.