Revert "FROMLIST: overlayfs: internal getxattr operations without sepolicy checking"

This reverts commit 4aa24aec05 as it was
not upstream and causes problems with the overlayfs upstream merge
point.  It needs to be added back "soon".

Cc: Mark Salyzyn <salyzyn@android.com>
Cc: kernel-team@android.com
Cc: Mark Salyzyn <salyzyn@google.com>
Bug: 133515582
Bug: 136124883
Bug: 129319403
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic429c8b13181fbaaf7e060b463e86bb9a06ad66e
This commit is contained in:
Greg Kroah-Hartman
2020-02-08 14:03:52 +01:00
parent 5905d79c33
commit d987f90515
3 changed files with 14 additions and 24 deletions
+5 -7
View File
@@ -106,11 +106,10 @@ int ovl_check_fb_len(struct ovl_fb *fb, int fb_len)
static struct ovl_fh *ovl_get_fh(struct dentry *dentry, const char *name)
{
ssize_t res;
int err;
int res, err;
struct ovl_fh *fh = NULL;
res = ovl_do_vfs_getxattr(dentry, name, NULL, 0);
res = vfs_getxattr(dentry, name, NULL, 0);
if (res < 0) {
if (res == -ENODATA || res == -EOPNOTSUPP)
return NULL;
@@ -124,7 +123,7 @@ static struct ovl_fh *ovl_get_fh(struct dentry *dentry, const char *name)
if (!fh)
return ERR_PTR(-ENOMEM);
res = ovl_do_vfs_getxattr(dentry, name, fh->buf, res);
res = vfs_getxattr(dentry, name, fh->buf, res);
if (res < 0)
goto fail;
@@ -142,11 +141,10 @@ out:
return NULL;
fail:
pr_warn_ratelimited("overlayfs: failed to get origin (%zi)\n", res);
pr_warn_ratelimited("overlayfs: failed to get origin (%i)\n", res);
goto out;
invalid:
pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n",
(int)res, fh);
pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n", res, fh);
goto out;
}
-8
View File
@@ -216,14 +216,6 @@ static inline bool ovl_open_flags_need_copy_up(int flags)
return ((OPEN_FMODE(flags) & FMODE_WRITE) || (flags & O_TRUNC));
}
static inline ssize_t ovl_do_vfs_getxattr(struct dentry *dentry,
const char *name, void *buf,
size_t size)
{
return __vfs_getxattr(dentry, d_inode(dentry), name, buf, size,
XATTR_NOSECURITY);
}
/* util.c */
int ovl_want_write(struct dentry *dentry);
void ovl_drop_write(struct dentry *dentry);
+9 -9
View File
@@ -537,9 +537,9 @@ void ovl_copy_up_end(struct dentry *dentry)
bool ovl_check_origin_xattr(struct dentry *dentry)
{
ssize_t res;
int res;
res = ovl_do_vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0);
res = vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0);
/* Zero size value means "copied up but origin unknown" */
if (res >= 0)
@@ -550,13 +550,13 @@ bool ovl_check_origin_xattr(struct dentry *dentry)
bool ovl_check_dir_xattr(struct dentry *dentry, const char *name)
{
ssize_t res;
int res;
char val;
if (!d_is_dir(dentry))
return false;
res = ovl_do_vfs_getxattr(dentry, name, &val, 1);
res = vfs_getxattr(dentry, name, &val, 1);
if (res == 1 && val == 'y')
return true;
@@ -837,13 +837,13 @@ err:
/* err < 0, 0 if no metacopy xattr, 1 if metacopy xattr found */
int ovl_check_metacopy_xattr(struct dentry *dentry)
{
ssize_t res;
int res;
/* Only regular files can have metacopy xattr */
if (!S_ISREG(d_inode(dentry)->i_mode))
return 0;
res = ovl_do_vfs_getxattr(dentry, OVL_XATTR_METACOPY, NULL, 0);
res = vfs_getxattr(dentry, OVL_XATTR_METACOPY, NULL, 0);
if (res < 0) {
if (res == -ENODATA || res == -EOPNOTSUPP)
return 0;
@@ -852,7 +852,7 @@ int ovl_check_metacopy_xattr(struct dentry *dentry)
return 1;
out:
pr_warn_ratelimited("overlayfs: failed to get metacopy (%zi)\n", res);
pr_warn_ratelimited("overlayfs: failed to get metacopy (%i)\n", res);
return res;
}
@@ -878,7 +878,7 @@ ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value,
ssize_t res;
char *buf = NULL;
res = ovl_do_vfs_getxattr(dentry, name, NULL, 0);
res = vfs_getxattr(dentry, name, NULL, 0);
if (res < 0) {
if (res == -ENODATA || res == -EOPNOTSUPP)
return -ENODATA;
@@ -890,7 +890,7 @@ ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value,
if (!buf)
return -ENOMEM;
res = ovl_do_vfs_getxattr(dentry, name, buf, res);
res = vfs_getxattr(dentry, name, buf, res);
if (res < 0)
goto fail;
}