linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org,
	viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Kirill A. Shutemov"
	<kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org>,
	xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/6] vfs: cap dedupe request structure size at PAGE_SIZE
Date: Mon, 12 Sep 2016 18:16:20 -0700	[thread overview]
Message-ID: <20160913011620.GC23422@birch.djwong.org> (raw)
In-Reply-To: <20160905145549.GA7662-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>

On Mon, Sep 05, 2016 at 07:55:49AM -0700, Christoph Hellwig wrote:
> This really should go into 4.8 (and the previous patch probably as
> well), and I've said that a couple of times, and you tried a few times
> to send it to Al at least.
> 
> Al, do you want to pick it up or should Darrick send it straight to
> Linus?

Ping?  Anyone?

--D

> On Thu, Aug 25, 2016 at 04:30:54PM -0700, Darrick J. Wong wrote:
> > Kirill A. Shutemov reports that the kernel doesn't try to cap dest_count
> > in any way, and uses the number to allocate kernel memory.  This causes
> > high order allocation warnings in the kernel log if someone passes in a
> > big enough value.  We should clamp the allocation at PAGE_SIZE to avoid
> > stressing the VM.
> > 
> > The two existing users of the dedupe ioctl never send more than 120
> > requests, so we can safely clamp dest_range at PAGE_SIZE, because with
> > 4k pages we can handle up to 127 dedupe candidates.  Given the max
> > extent length of 16MB, we can end up doing 2GB of IO which is plenty.
> > 
> > Reported-by: "Kirill A. Shutemov" <kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org>
> > Signed-off-by: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > ---
> >  fs/ioctl.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > 
> > diff --git a/fs/ioctl.c b/fs/ioctl.c
> > index 26aba09..c415668 100644
> > --- a/fs/ioctl.c
> > +++ b/fs/ioctl.c
> > @@ -582,6 +582,10 @@ static int ioctl_file_dedupe_range(struct file *file, void __user *arg)
> >  	}
> >  
> >  	size = offsetof(struct file_dedupe_range __user, info[count]);
> > +	if (size > PAGE_SIZE) {
> > +		ret = -ENOMEM;
> > +		goto out;
> > +	}
> >  
> >  	same = memdup_user(argp, size);
> >  	if (IS_ERR(same)) {
> > 
> > _______________________________________________
> > xfs mailing list
> > xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org
> > http://oss.sgi.com/mailman/listinfo/xfs
> ---end quoted text---

  parent reply	other threads:[~2016-09-13  1:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 23:30 [PATCH v8 0/6] vfs: help support reflink for XFS Darrick J. Wong
2016-08-25 23:30 ` [PATCH 1/6] vfs: fix return type of ioctl_file_dedupe_range Darrick J. Wong
2016-08-25 23:30 ` [PATCH 2/6] vfs: cap dedupe request structure size at PAGE_SIZE Darrick J. Wong
     [not found]   ` <147216785429.525.1965983896010934181.stgit-PTl6brltDGh4DFYR7WNSRA@public.gmane.org>
2016-09-05 14:55     ` Christoph Hellwig
     [not found]       ` <20160905145549.GA7662-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-09-13  1:16         ` Darrick J. Wong [this message]
2016-09-14 20:22           ` Christoph Hellwig
2016-08-25 23:31 ` [PATCH 3/6] vfs: support FS_XFLAG_REFLINK and FS_XFLAG_COWEXTSIZE Darrick J. Wong
     [not found]   ` <147216786073.525.16014208838990530622.stgit-PTl6brltDGh4DFYR7WNSRA@public.gmane.org>
2016-09-05 14:56     ` Christoph Hellwig
     [not found]       ` <20160905145622.GB7662-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-09-06 19:15         ` Darrick J. Wong
2016-09-11 12:58           ` Christoph Hellwig
2016-09-12 19:12             ` Darrick J. Wong
2016-08-25 23:31 ` [PATCH 4/6] fs: add iomap_file_dirty Christoph Hellwig
2016-09-05 14:57   ` Christoph Hellwig
2016-09-06 17:34     ` Darrick J. Wong
2016-09-11 12:58       ` Christoph Hellwig
     [not found]     ` <20160905145751.GC7662-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-09-19  0:11       ` Dave Chinner
2016-08-25 23:31 ` [PATCH 5/6] iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems Darrick J. Wong
     [not found] ` <147216784041.525.7722906502172299465.stgit-PTl6brltDGh4DFYR7WNSRA@public.gmane.org>
2016-08-25 23:31   ` [PATCH 6/6] iomap: add a flag to report shared extents Darrick J. Wong
2016-09-05 14:58     ` Christoph Hellwig

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=20160913011620.GC23422@birch.djwong.org \
    --to=darrick.wong-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org \
    --cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).