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]
Message-ID: <20150123015307.GD24722@dastard>
Date:	Fri, 23 Jan 2015 12:53:07 +1100
From:	Dave Chinner <david@...morbit.com>
To:	Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc:	Li Xi <pkuelelixi@...il.com>, linux-fsdevel@...r.kernel.org,
	linux-ext4@...r.kernel.org, linux-api@...r.kernel.org,
	tytso@....edu, adilger@...ger.ca, jack@...e.cz,
	viro@...iv.linux.org.uk, hch@...radead.org, dmonakhov@...nvz.org
Subject: Re: [v8 4/5] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR
 interface support

On Thu, Jan 22, 2015 at 06:28:51PM +0300, Konstantin Khlebnikov wrote:
> On 09.12.2014 08:22, Li Xi wrote:
> >+static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
> >+{
> >+	struct inode *inode = file_inode(filp);
> >+	struct super_block *sb = inode->i_sb;
> >+	struct ext4_inode_info *ei = EXT4_I(inode);
> >+	int err;
> >+	handle_t *handle;
> >+	kprojid_t kprojid;
> >+	struct ext4_iloc iloc;
> >+	struct ext4_inode *raw_inode;
> >+
> >+	struct dquot *transfer_to[EXT4_MAXQUOTAS] = { };
> >+
> >+	/* Make sure caller can change project. */
> >+	if (!capable(CAP_SYS_ADMIN))
> >+		return -EACCES;
> >+
> >+	if (projid != EXT4_DEF_PROJID
> >+	    && !EXT4_HAS_RO_COMPAT_FEATURE(sb,
> >+			EXT4_FEATURE_RO_COMPAT_PROJECT))
> >+		return -EOPNOTSUPP;
> >+
> >+	if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
> >+			EXT4_FEATURE_RO_COMPAT_PROJECT)) {
> >+		BUG_ON(__kprojid_val(EXT4_I(inode)->i_projid)
> >+		       != EXT4_DEF_PROJID);
> >+		if (projid != EXT4_DEF_PROJID)
> >+			return -EOPNOTSUPP;
> >+		else
> >+			return 0;
> >+	}
> >+
> >+	kprojid = make_kprojid(&init_user_ns, (projid_t)projid);
> 
> Maybe current_user_ns()?
> This code should be user-namespace aware from the beginning.

No, the code is correct. Project quotas have nothing to do with
UIDs and so should never have been included in the uid/gid
namespace mapping infrastructure in the first place.

Point in case: directory subtree quotas can be used as a resource
controller for limiting space usage within separate containers that
share the same underlying (large) filesystem via mount namespaces.

Cheers,

Dave.

PS: can you please trim your reply to just the sections of the
patch you are commenting to? Finding replies like this in a large
patch is like searching for a needle in a haystack...
-- 
Dave Chinner
david@...morbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ