From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: [PATCH] fuse: Only allow read/writing user xattrs Date: Fri, 05 Oct 2012 15:50:48 -0700 Message-ID: <87boggpm7r.fsf@xmission.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , To: Miklos Szeredi Return-path: Sender: linux-security-module-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org In the context of unprivileged mounts supporting anything except xattrs with the "user." prefix seems foolish. Return -EOPNOSUPP for all other types of xattrs. Cc: Miklos Szeredi Signed-off-by: "Eric W. Biederman" --- Do we really have a kernel bug as blantant as this appears? fs/fuse/dir.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 45a27c4..260de56 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -13,6 +13,7 @@ #include #include #include +#include #if BITS_PER_LONG >= 64 static inline void fuse_dentry_settime(struct dentry *entry, u64 time) @@ -1537,6 +1538,9 @@ static int fuse_setxattr(struct dentry *entry, const char *name, if (fc->no_setxattr) return -EOPNOTSUPP; + if (strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) != 0) + return -EOPNOTSUPP; + req = fuse_get_req(fc); if (IS_ERR(req)) return PTR_ERR(req); @@ -1576,6 +1580,9 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name, if (fc->no_getxattr) return -EOPNOTSUPP; + if (strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) != 0) + return -EOPNOTSUPP; + req = fuse_get_req(fc); if (IS_ERR(req)) return PTR_ERR(req); -- 1.7.5.4