Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5f03ad3 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

Build break

Revert "FROMLIST: BACKPORT: overlayfs: override_creds=off option bypass creator_cred"

This reverts commit 3bc419d8.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I44312d18aeb84ace19f7d27ec3bcb219183d95fa
parent 3bc419d8
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -82,29 +82,6 @@ Only the lists of names from directories are merged. Other content
such as metadata and extended attributes are reported for the upper
directory only.  These attributes of the lower directory are hidden.

credentials
-----------

By default, all access to the upper, lower and work directories is the
recorded mounter's MAC and DAC credentials.  The incoming accesses are
checked against the caller's credentials.

In the case where caller MAC or DAC credentials do not overlap, a
use case available in older versions of the driver, the
override_creds mount flag can be turned off and help when the use
pattern has caller with legitimate credentials where the mounter
does not.  Several unintended side effects will occur though.  The
caller without certain key capabilities or lower privilege will not
always be able to delete files or directories, create nodes, or
search some restricted directories.  The ability to search and read
a directory entry is spotty as a result of the cache mechanism not
retesting the credentials because of the assumption, a privileged
caller can fill cache, then a lower privilege can read the directory
cache.  The uneven security model where cache, upperdir and workdir
are opened at privilege, but accessed without creating a form of
privilege escalation, should only be used with strict understanding
of the side effects and of the security policies.

whiteouts and opaque directories
--------------------------------

+1 −1
Original line number Diff line number Diff line
@@ -421,7 +421,7 @@ int ovl_copy_up(struct dentry *dentry)
		dput(parent);
		dput(next);
	}
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);

	return err;
}
+5 −6
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,
	type = ovl_path_real(dentry, &realpath);
	old_cred = ovl_override_creds(dentry->d_sb);
	err = vfs_getattr(&realpath, stat);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	if (err)
		return err;

@@ -497,8 +497,7 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
		override_cred->fsgid = inode->i_gid;
		if (!hardlink) {
			err = security_dentry_create_files_as(dentry,
					stat->mode, &dentry->d_name,
					old_cred ? old_cred : current_cred(),
					stat->mode, &dentry->d_name, old_cred,
					override_cred);
			if (err) {
				put_cred(override_cred);
@@ -516,7 +515,7 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
							link, hardlink);
	}
out_revert_creds:
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	if (!err) {
		struct inode *realinode = d_inode(ovl_dentry_upper(dentry));

@@ -758,7 +757,7 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir)
		err = ovl_remove_upper(dentry, is_dir);
	else
		err = ovl_remove_and_whiteout(dentry, is_dir);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	if (!err) {
		if (is_dir)
			clear_nlink(dentry->d_inode);
@@ -999,7 +998,7 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old,
out_unlock:
	unlock_rename(new_upperdir, old_upperdir);
out_revert_creds:
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
out_drop_write:
	ovl_drop_write(old);
out:
+9 −9
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ static int ovl_copy_up_truncate(struct dentry *dentry)
		stat.size = 0;
		err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat);
	}
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);

out_dput_parent:
	dput(parent);
@@ -91,7 +91,7 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
		inode_lock(upperdentry->d_inode);
		old_cred = ovl_override_creds(dentry->d_sb);
		err = notify_change(upperdentry, attr, NULL);
		ovl_revert_creds(old_cred);
		revert_creds(old_cred);
		if (!err)
			ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
		inode_unlock(upperdentry->d_inode);
@@ -115,7 +115,7 @@ static int ovl_getattr(struct vfsmount *mnt, struct dentry *dentry,
	ovl_path_real(dentry, &realpath);
	old_cred = ovl_override_creds(dentry->d_sb);
	err = vfs_getattr(&realpath, stat);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	return err;
}

@@ -147,7 +147,7 @@ int ovl_permission(struct inode *inode, int mask)
		mask |= MAY_READ;
	}
	err = inode_permission(realinode, mask);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);

	return err;
}
@@ -164,7 +164,7 @@ static const char *ovl_get_link(struct dentry *dentry,

	old_cred = ovl_override_creds(dentry->d_sb);
	p = vfs_get_link(ovl_dentry_real(dentry), done);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	return p;
}

@@ -206,7 +206,7 @@ int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value,
		WARN_ON(flags != XATTR_REPLACE);
		err = vfs_removexattr(realpath.dentry, name);
	}
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);

out_drop_write:
	ovl_drop_write(dentry);
@@ -223,7 +223,7 @@ int ovl_xattr_get(struct dentry *dentry, const char *name,

	old_cred = ovl_override_creds(dentry->d_sb);
	res = vfs_getxattr(realdentry, name, value, size);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	return res;
}

@@ -247,7 +247,7 @@ ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)

	old_cred = ovl_override_creds(dentry->d_sb);
	res = vfs_listxattr(realdentry, list, size);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);
	if (res <= 0 || size == 0)
		return res;

@@ -282,7 +282,7 @@ struct posix_acl *ovl_get_acl(struct inode *inode, int type)

	old_cred = ovl_override_creds(inode->i_sb);
	acl = get_acl(realinode, type);
	ovl_revert_creds(old_cred);
	revert_creds(old_cred);

	return acl;
}
+0 −1
Original line number Diff line number Diff line
@@ -164,7 +164,6 @@ bool ovl_dentry_is_opaque(struct dentry *dentry);
void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque);
bool ovl_is_whiteout(struct dentry *dentry);
const struct cred *ovl_override_creds(struct super_block *sb);
void ovl_revert_creds(const struct cred *oldcred);
void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry);
void ovl_inode_update(struct inode *inode, struct inode *upperinode);
struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
Loading