From: bfields@fieldses.org (J. Bruce Fields)
To: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Cc: trond.myklebust@primarydata.com, anna.schumaker@netapp.com,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2] Prevent rqstp->rq_pages[RPCSVC_MAXPAGES] overrun
Date: Tue, 26 Jul 2016 16:19:47 -0400 [thread overview]
Message-ID: <20160726201947.GA8387@fieldses.org> (raw)
In-Reply-To: <28fb2e47-48ce-1af7-3135-15ca9b4e1726@jp.fujitsu.com>
Thanks for the report.
On Tue, Jul 26, 2016 at 11:38:11AM +0900, Seiichi Ikarashi wrote:
> If over-"RPCSVC_MAXPAGES" pages are sent from file system through pipe_buffer,
> nfsd_splice_actor() corrupts struct svc_rqst and results in kernel panic. It
> actually occurred with a parallel distributed file system. It needs boundary
> checking.
This check might be useful as defensive programming, but the bug was
elsewhere.
In theory this should be prevented by the "maxcount" calculations in
nfsd4_encode_read().
What version of the kernel did you see this happen on? What was the
client, and what was it doing? Any other hints on reproducing?
--b.
>
> v2: Fix semicolon-missing bug.
>
> Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
>
> ---
> fs/nfsd/vfs.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 6fbd81e..43393f3 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -811,12 +811,20 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
> size = sd->len;
>
> if (rqstp->rq_res.page_len == 0) {
> + if (rqstp->rq_next_page > &rqstp->rq_pages[RPCSVC_MAXPAGES-1]) {
> + WARN_ON(1);
> + return -ENOMEM;
> + }
> get_page(page);
> put_page(*rqstp->rq_next_page);
> *(rqstp->rq_next_page++) = page;
> rqstp->rq_res.page_base = buf->offset;
> rqstp->rq_res.page_len = size;
> } else if (page != pp[-1]) {
> + if (rqstp->rq_next_page > &rqstp->rq_pages[RPCSVC_MAXPAGES-1]) {
> + WARN_ON(1);
> + return -ENOMEM;
> + }
> get_page(page);
> if (*rqstp->rq_next_page)
> put_page(*rqstp->rq_next_page);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-07-26 20:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 2:38 [PATCH v2] Prevent rqstp->rq_pages[RPCSVC_MAXPAGES] overrun Seiichi Ikarashi
2016-07-26 20:19 ` J. Bruce Fields [this message]
2016-07-26 23:57 ` Seiichi Ikarashi
2016-07-27 0:26 ` J. Bruce Fields
2016-07-27 1:06 ` Seiichi Ikarashi
2016-07-28 18:25 ` J. Bruce Fields
2016-08-01 9:43 ` Seiichi Ikarashi
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=20160726201947.GA8387@fieldses.org \
--to=bfields@fieldses.org \
--cc=anna.schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=s.ikarashi@jp.fujitsu.com \
--cc=trond.myklebust@primarydata.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