mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "Giorgi Kobakhia" <gkobakhi@asu.edu>, "Jeff Layton" <jlayton@kernel.org>
Cc: NeilBrown <neil@brown.name>,
	"Olga Kornievskaia" <okorniev@redhat.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Xiang Mei" <xmei5@asu.edu>,
	linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] svcrdma: bound check rc_curpage in svc_rdma_build_read_segment
Date: Thu, 22 Oct 2026 08:22:20 -0400	[thread overview]
Message-ID: <d8952be8-7ee8-4c57-aea3-9f19011b377f@app.fastmail.com> (raw)
In-Reply-To: <20261021203817.3898293-1-gkobakhi@asu.edu>



On Wed, Oct 21, 2026, at 4:38 PM, Giorgi Kobakhia wrote:
> The existing guard in the end of loop is not enough for bounding
> rc_curpage, because it only checks if some part of the chunk goes beyond
> the rq_maxpages.
>
>     if (len && ((head->rc_curpage + 1) > rqstp->rq_maxpages))
> 	goto out_put;
>
> If the chunk exactly fills up the pages, then len is 0, guard is skipped
> and the next chunk makes head->rc_curpage go over rq_maxpages.
>
> Commit 81381d1a90de ("svcrdma: Adjust the number of entries in
> svc_rdma_recv_ctxt::rc_pages") made OOB accessible, since it
> shrunk the rc_pages array size to rc_maxpages.
>
> Commit d1bea0ce35b6 ("svcrdma: bound check rq_pages index in inline
> path") added a loop-top "rc_curpage >= rq_maxpages" guard in nearby
> function svc_rdma_copy_inline_range(). The same check would guard it in
> svc_rdma_build_read_segment().
>
> OOB write is triggered in svc_rdma_process_read_list():
>
>  BUG: KASAN: slab-out-of-bounds in svc_rdma_process_read_list
>         (svc_rdma_rw.c:1148 svc_rdma_rw.c:1197)
>  Write of size 8
>
>  Call Trace:
>   svc_rdma_process_read_list (svc_rdma_rw.c:1148 svc_rdma_rw.c:1197)
>   svc_rdma_recvfrom (net/sunrpc/xprtrdma/svc_rdma_recvfrom.c:1022)
>   svc_recv (net/sunrpc/svc_xprt.c:870 net/sunrpc/svc_xprt.c:968)
>   nfsd (fs/nfsd/nfssvc.c:919)
>
> Add bound check for rc_curpage in the beginning of the loop.
>
> Fixes: 81381d1a90de ("svcrdma: Adjust the number of entries in 
> svc_rdma_recv_ctxt::rc_pages")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Tested-by: Xiang Mei <xmei5@asu.edu>
> Signed-off-by: Giorgi Kobakhia <gkobakhi@asu.edu>

Commit 4e84914d70a0 "svcrdma: account for inline bytes in Read chunk page
budget" in the nfsd-testing branch already carries this guard and addresses
the same KASAN report. Thanks for the independent confirmation.


-- 
Chuck Lever (Come to NFS bake-a-thon! https://nfsv4bat.org)

      parent reply	other threads:[~2026-10-22 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 20:38 Giorgi Kobakhia
2026-10-21 20:42 ` netdev-bot+sinfo
2026-10-22 12:22 ` Chuck Lever [this message]

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=d8952be8-7ee8-4c57-aea3-9f19011b377f@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=gkobakhi@asu.edu \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tom@talpey.com \
    --cc=xmei5@asu.edu \
    /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

all inboxes | Powered by JetHome®