Loading fs/overlayfs/inode.c +15 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,21 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, return err; } int __ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { ssize_t res; const struct cred *old_cred; struct dentry *realdentry = ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry); old_cred = ovl_override_creds(dentry->d_sb); res = __vfs_getxattr(realdentry, d_inode(realdentry), name, value, size); ovl_revert_creds(old_cred); return res; } int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { Loading fs/overlayfs/namei.c +10 −9 Original line number Diff line number Diff line Loading @@ -29,10 +29,10 @@ struct ovl_lookup_data { static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, size_t prelen, const char *post) { int res; ssize_t res; char *s, *next, *buf = NULL; res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, NULL, 0); res = ovl_vfs_getxattr(dentry, OVL_XATTR_REDIRECT, NULL, 0); if (res < 0) { if (res == -ENODATA || res == -EOPNOTSUPP) return 0; Loading @@ -45,7 +45,7 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, if (res == 0) goto invalid; res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res); res = ovl_vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res); if (res < 0) goto fail; if (res == 0) Loading Loading @@ -85,7 +85,7 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, kfree(buf); return 0; fail: pr_warn_ratelimited("overlayfs: failed to get redirect (%i)\n", res); pr_warn_ratelimited("overlayfs: failed to get redirect (%zi)\n", res); goto err_free; invalid: pr_warn_ratelimited("overlayfs: invalid redirect (%s)\n", buf); Loading @@ -99,10 +99,10 @@ static int ovl_acceptable(void *ctx, struct dentry *dentry) static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry) { int res; ssize_t res; struct ovl_fh *fh = NULL; res = vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0); res = ovl_vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0); if (res < 0) { if (res == -ENODATA || res == -EOPNOTSUPP) return NULL; Loading @@ -116,7 +116,7 @@ static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry) if (!fh) return ERR_PTR(-ENOMEM); res = vfs_getxattr(dentry, OVL_XATTR_ORIGIN, fh, res); res = ovl_vfs_getxattr(dentry, OVL_XATTR_ORIGIN, fh, res); if (res < 0) goto fail; Loading @@ -142,10 +142,11 @@ static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry) return NULL; fail: pr_warn_ratelimited("overlayfs: failed to get origin (%i)\n", res); pr_warn_ratelimited("overlayfs: failed to get origin (%zi)\n", res); goto out; invalid: pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n", res, fh); pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n", (int)res, fh); goto out; } Loading fs/overlayfs/overlayfs.h +4 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ void ovl_drop_write(struct dentry *dentry); struct dentry *ovl_workdir(struct dentry *dentry); const struct cred *ovl_override_creds(struct super_block *sb); void ovl_revert_creds(const struct cred *oldcred); ssize_t ovl_vfs_getxattr(struct dentry *dentry, const char *name, void *buf, size_t size); struct super_block *ovl_same_sb(struct super_block *sb); bool ovl_can_decode_fh(struct super_block *sb); struct dentry *ovl_indexdir(struct super_block *sb); Loading Loading @@ -280,6 +282,8 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags); int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); int __ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); struct posix_acl *ovl_get_acl(struct inode *inode, int type); int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags); Loading fs/overlayfs/super.c +18 −0 Original line number Diff line number Diff line Loading @@ -733,6 +733,14 @@ ovl_posix_acl_xattr_get(const struct xattr_handler *handler, return ovl_xattr_get(dentry, inode, handler->name, buffer, size); } static int __maybe_unused __ovl_posix_acl_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { return __ovl_xattr_get(dentry, inode, handler->name, buffer, size); } static int __maybe_unused ovl_posix_acl_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, Loading Loading @@ -813,6 +821,13 @@ static int ovl_other_xattr_get(const struct xattr_handler *handler, return ovl_xattr_get(dentry, inode, name, buffer, size); } static int __ovl_other_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { return __ovl_xattr_get(dentry, inode, name, buffer, size); } static int ovl_other_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, const void *value, Loading @@ -826,6 +841,7 @@ ovl_posix_acl_access_xattr_handler = { .name = XATTR_NAME_POSIX_ACL_ACCESS, .flags = ACL_TYPE_ACCESS, .get = ovl_posix_acl_xattr_get, .__get = __ovl_posix_acl_xattr_get, .set = ovl_posix_acl_xattr_set, }; Loading @@ -834,6 +850,7 @@ ovl_posix_acl_default_xattr_handler = { .name = XATTR_NAME_POSIX_ACL_DEFAULT, .flags = ACL_TYPE_DEFAULT, .get = ovl_posix_acl_xattr_get, .__get = __ovl_posix_acl_xattr_get, .set = ovl_posix_acl_xattr_set, }; Loading @@ -846,6 +863,7 @@ static const struct xattr_handler ovl_own_xattr_handler = { static const struct xattr_handler ovl_other_xattr_handler = { .prefix = "", /* catch all */ .get = ovl_other_xattr_get, .__get = __ovl_other_xattr_get, .set = ovl_other_xattr_set, }; Loading fs/overlayfs/util.c +8 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,12 @@ void ovl_revert_creds(const struct cred *old_cred) revert_creds(old_cred); } ssize_t ovl_vfs_getxattr(struct dentry *dentry, const char *name, void *buf, size_t size) { return __vfs_getxattr(dentry, d_inode(dentry), name, buf, size); } struct super_block *ovl_same_sb(struct super_block *sb) { struct ovl_fs *ofs = sb->s_fs_info; Loading Loading @@ -339,13 +345,13 @@ void ovl_copy_up_end(struct dentry *dentry) bool ovl_check_dir_xattr(struct dentry *dentry, const char *name) { int res; ssize_t res; char val; if (!d_is_dir(dentry)) return false; res = vfs_getxattr(dentry, name, &val, 1); res = ovl_vfs_getxattr(dentry, name, &val, 1); if (res == 1 && val == 'y') return true; Loading Loading
fs/overlayfs/inode.c +15 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,21 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, return err; } int __ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { ssize_t res; const struct cred *old_cred; struct dentry *realdentry = ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry); old_cred = ovl_override_creds(dentry->d_sb); res = __vfs_getxattr(realdentry, d_inode(realdentry), name, value, size); ovl_revert_creds(old_cred); return res; } int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { Loading
fs/overlayfs/namei.c +10 −9 Original line number Diff line number Diff line Loading @@ -29,10 +29,10 @@ struct ovl_lookup_data { static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, size_t prelen, const char *post) { int res; ssize_t res; char *s, *next, *buf = NULL; res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, NULL, 0); res = ovl_vfs_getxattr(dentry, OVL_XATTR_REDIRECT, NULL, 0); if (res < 0) { if (res == -ENODATA || res == -EOPNOTSUPP) return 0; Loading @@ -45,7 +45,7 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, if (res == 0) goto invalid; res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res); res = ovl_vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res); if (res < 0) goto fail; if (res == 0) Loading Loading @@ -85,7 +85,7 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, kfree(buf); return 0; fail: pr_warn_ratelimited("overlayfs: failed to get redirect (%i)\n", res); pr_warn_ratelimited("overlayfs: failed to get redirect (%zi)\n", res); goto err_free; invalid: pr_warn_ratelimited("overlayfs: invalid redirect (%s)\n", buf); Loading @@ -99,10 +99,10 @@ static int ovl_acceptable(void *ctx, struct dentry *dentry) static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry) { int res; ssize_t res; struct ovl_fh *fh = NULL; res = vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0); res = ovl_vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0); if (res < 0) { if (res == -ENODATA || res == -EOPNOTSUPP) return NULL; Loading @@ -116,7 +116,7 @@ static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry) if (!fh) return ERR_PTR(-ENOMEM); res = vfs_getxattr(dentry, OVL_XATTR_ORIGIN, fh, res); res = ovl_vfs_getxattr(dentry, OVL_XATTR_ORIGIN, fh, res); if (res < 0) goto fail; Loading @@ -142,10 +142,11 @@ static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry) return NULL; fail: pr_warn_ratelimited("overlayfs: failed to get origin (%i)\n", res); pr_warn_ratelimited("overlayfs: failed to get origin (%zi)\n", res); goto out; invalid: pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n", res, fh); pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n", (int)res, fh); goto out; } Loading
fs/overlayfs/overlayfs.h +4 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ void ovl_drop_write(struct dentry *dentry); struct dentry *ovl_workdir(struct dentry *dentry); const struct cred *ovl_override_creds(struct super_block *sb); void ovl_revert_creds(const struct cred *oldcred); ssize_t ovl_vfs_getxattr(struct dentry *dentry, const char *name, void *buf, size_t size); struct super_block *ovl_same_sb(struct super_block *sb); bool ovl_can_decode_fh(struct super_block *sb); struct dentry *ovl_indexdir(struct super_block *sb); Loading Loading @@ -280,6 +282,8 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags); int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); int __ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); struct posix_acl *ovl_get_acl(struct inode *inode, int type); int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags); Loading
fs/overlayfs/super.c +18 −0 Original line number Diff line number Diff line Loading @@ -733,6 +733,14 @@ ovl_posix_acl_xattr_get(const struct xattr_handler *handler, return ovl_xattr_get(dentry, inode, handler->name, buffer, size); } static int __maybe_unused __ovl_posix_acl_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { return __ovl_xattr_get(dentry, inode, handler->name, buffer, size); } static int __maybe_unused ovl_posix_acl_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, Loading Loading @@ -813,6 +821,13 @@ static int ovl_other_xattr_get(const struct xattr_handler *handler, return ovl_xattr_get(dentry, inode, name, buffer, size); } static int __ovl_other_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { return __ovl_xattr_get(dentry, inode, name, buffer, size); } static int ovl_other_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, const void *value, Loading @@ -826,6 +841,7 @@ ovl_posix_acl_access_xattr_handler = { .name = XATTR_NAME_POSIX_ACL_ACCESS, .flags = ACL_TYPE_ACCESS, .get = ovl_posix_acl_xattr_get, .__get = __ovl_posix_acl_xattr_get, .set = ovl_posix_acl_xattr_set, }; Loading @@ -834,6 +850,7 @@ ovl_posix_acl_default_xattr_handler = { .name = XATTR_NAME_POSIX_ACL_DEFAULT, .flags = ACL_TYPE_DEFAULT, .get = ovl_posix_acl_xattr_get, .__get = __ovl_posix_acl_xattr_get, .set = ovl_posix_acl_xattr_set, }; Loading @@ -846,6 +863,7 @@ static const struct xattr_handler ovl_own_xattr_handler = { static const struct xattr_handler ovl_other_xattr_handler = { .prefix = "", /* catch all */ .get = ovl_other_xattr_get, .__get = __ovl_other_xattr_get, .set = ovl_other_xattr_set, }; Loading
fs/overlayfs/util.c +8 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,12 @@ void ovl_revert_creds(const struct cred *old_cred) revert_creds(old_cred); } ssize_t ovl_vfs_getxattr(struct dentry *dentry, const char *name, void *buf, size_t size) { return __vfs_getxattr(dentry, d_inode(dentry), name, buf, size); } struct super_block *ovl_same_sb(struct super_block *sb) { struct ovl_fs *ofs = sb->s_fs_info; Loading Loading @@ -339,13 +345,13 @@ void ovl_copy_up_end(struct dentry *dentry) bool ovl_check_dir_xattr(struct dentry *dentry, const char *name) { int res; ssize_t res; char val; if (!d_is_dir(dentry)) return false; res = vfs_getxattr(dentry, name, &val, 1); res = ovl_vfs_getxattr(dentry, name, &val, 1); if (res == 1 && val == 'y') return true; Loading