From: Omar Sandoval <osandov@osandov.com>
To: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Aleksa Sarai <cyphar@cyphar.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>,
Dave Chinner <david@fromorbit.com>, Jann Horn <jannh@google.com>,
Amir Goldstein <amir73il@gmail.com>,
Linux API <linux-api@vger.kernel.org>,
Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v9 1/9] iov_iter: add copy_struct_from_iter()
Date: Fri, 2 Apr 2021 10:50:50 -0700 [thread overview]
Message-ID: <YGdZeh4K3BxQPcGx@relinquished.localdomain> (raw)
In-Reply-To: <20210402080423.t26zd34p2oxbzvuj@wittgenstein>
On Fri, Apr 02, 2021 at 10:04:23AM +0200, Christian Brauner wrote:
> On Fri, Apr 02, 2021 at 12:33:20AM -0700, Omar Sandoval wrote:
> > On Thu, Apr 01, 2021 at 09:05:22AM -0700, Linus Torvalds wrote:
> > > On Wed, Mar 31, 2021 at 11:51 PM Omar Sandoval <osandov@osandov.com> wrote:
> > > >
> > > > + *
> > > > + * The recommended usage is something like the following:
> > > > + *
> > > > + * if (usize > PAGE_SIZE)
> > > > + * return -E2BIG;
> > >
> > > Maybe this should be more than a recommendation, and just be inside
> > > copy_struct_from_iter(), because otherwise the "check_zeroed_user()"
> > > call might be quite the timesink for somebody who does something
> > > stupid.
> >
> > I did actually almost send this out with the check in
> > copy_struct_from_iter(), but decided not to for consistency with
> > copy_struct_from_user().
> >
> > openat2() seems to be the only user of copy_struct_from_user() that
> > doesn't limit to PAGE_SIZE, which is odd given that Aleksa wrote both
>
> Al said there's nothing wrong with copying large chunks of memory so we
> shouldn't limit the helper but instead limit the callers which have
> expectations about their size limit:
> https://lore.kernel.org/lkml/20190905182801.GR1131@ZenIV.linux.org.uk/
Thanks for the context. So I guess it makes sense to keep the check
"recommended" for both functions.
next prev parent reply other threads:[~2021-04-02 17:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 6:51 [PATCH v9 0/9] fs: interface for directly reading/writing compressed data Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 1/9] iov_iter: add copy_struct_from_iter() Omar Sandoval
2021-04-01 16:05 ` Linus Torvalds
2021-04-02 7:33 ` Omar Sandoval
2021-04-02 8:04 ` Christian Brauner
2021-04-02 17:50 ` Omar Sandoval [this message]
2021-04-01 6:51 ` [PATCH v9 2/9] fs: add O_ALLOW_ENCODED open flag Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 3/9] fs: add RWF_ENCODED for reading/writing compressed data Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 4/9] btrfs: don't advance offset for compressed bios in btrfs_csum_one_bio() Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 5/9] btrfs: add ram_bytes and offset to btrfs_ordered_extent Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 6/9] btrfs: support different disk extent size for delalloc Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 7/9] btrfs: optionally extend i_size in cow_file_range_inline() Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 8/9] btrfs: implement RWF_ENCODED reads Omar Sandoval
2021-04-01 6:51 ` [PATCH v9 9/9] btrfs: implement RWF_ENCODED writes Omar Sandoval
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=YGdZeh4K3BxQPcGx@relinquished.localdomain \
--to=osandov@osandov.com \
--cc=amir73il@gmail.com \
--cc=christian.brauner@ubuntu.com \
--cc=cyphar@cyphar.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=jannh@google.com \
--cc=kernel-team@fb.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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