lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 03 Mar 2020 11:37:28 -0800
From:   "Daniel Xu" <dxu@...uu.xyz>
To:     "Daniel Xu" <dxu@...uu.xyz>, "Tejun Heo" <tj@...nel.org>
Cc:     <cgroups@...r.kernel.org>, <lizefan@...wei.com>,
        <hannes@...xchg.org>, <linux-kernel@...r.kernel.org>,
        <gregkh@...uxfoundation.org>, <kernel-team@...com>
Subject: Re: [PATCH 1/2] kernfs: Add option to enable user xattrs

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ