From: "Daniel Xu" <dxu@dxuuu.xyz>
To: "Daniel Xu" <dxu@dxuuu.xyz>, "Tejun Heo" <tj@kernel.org>
Cc: <cgroups@vger.kernel.org>, <lizefan@huawei.com>,
<hannes@cmpxchg.org>, <linux-kernel@vger.kernel.org>,
<gregkh@linuxfoundation.org>, <kernel-team@fb.com>
Subject: Re: [PATCH 1/2] kernfs: Add option to enable user xattrs
Date: Tue, 03 Mar 2020 11:37:28 -0800 [thread overview]
Message-ID: <C11GC2SN5D18.2S00I3KONE9ZE@dlxu-fedora-R90QNFJV> (raw)
In-Reply-To: <C11FYO0Q9WJU.2MLRRFOQ3E878@dlxu-fedora-R90QNFJV>
On Tue Mar 3, 2020 at 11:19 AM, Daniel Xu wrote:
> On Tue Mar 3, 2020 at 8:19 AM, Tejun Heo wrote:
> > Hello,
> >
> >
> > On Mon, Mar 02, 2020 at 05:39:00PM -0800, Daniel Xu wrote:
> > > +static int kernfs_vfs_user_xattr_set(const struct xattr_handler *handler,
> > > + struct dentry *unused, struct inode *inode,
> > > + const char *suffix, const void *value,
> > > + size_t size, int flags)
> > > +{
> > ...
> > > + if (value && atomic_inc_return(nr) > KERNFS_MAX_USER_XATTRS) {
> > > + ret = -ENOSPC;
> > > + goto dec_out;
> > > + }
> >
> >
> > So, we limit the number of user xattrs here but
> >
> >
> > > + ret = kernfs_vfs_xattr_set(handler, unused, inode, suffix, value,
> > > + size, flags);
> >
> >
> > This will call into simple_xattr_set() which doesn't put any further
> > restriction on size and just calls GFP_KERNEL kmalloc on it allowing
> > users incur high-order allocations. Maybe it'd make sense to limit
> > both the number and size?
>
>
> Ah yeah good point. Will add.
>
It looks like in fs/xattr.c:setxattr, there is already:
...
if (size) {
if (size > XATTR_SIZE_MAX)
return -E2BIG;
...
where XATTR_SIZE_MAX is defined as 64k. Do you want it even smaller?
Thanks,
Daniel
next prev parent reply other threads:[~2020-03-03 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 1:38 [PATCH 0/2] Support user xattrs in cgroupfs Daniel Xu
2020-03-03 1:39 ` [PATCH 1/2] kernfs: Add option to enable user xattrs Daniel Xu
2020-03-03 13:19 ` Tejun Heo
2020-03-03 19:19 ` Daniel Xu
2020-03-03 19:37 ` Daniel Xu [this message]
2020-03-04 16:39 ` Tejun Heo
2020-03-03 1:39 ` [PATCH 2/2] cgroupfs: Support " Daniel Xu
2020-03-03 16:50 ` [PATCH 0/2] Support user xattrs in cgroupfs Shakeel Butt
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=C11GC2SN5D18.2S00I3KONE9ZE@dlxu-fedora-R90QNFJV \
--to=dxu@dxuuu.xyz \
--cc=cgroups@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=tj@kernel.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
all inboxes | Powered by JetHome®