Bug 94291 - Bad xattr names (prefix.) allowed to be set
Summary: Bad xattr names (prefix.) allowed to be set
Status: RESOLVED PATCH_ALREADY_AVAILABLE
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-04 22:38 UTC by William Douglas
Modified: 2015-03-25 18:27 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.18
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description William Douglas 2015-03-04 22:38:21 UTC
The btrfs_is_valid_xattr function allows names of the form "prefix." which don't make much sense as valid names. Having at least "prefix.*" should be required for a valid name and is the behavior exhibited by the ext filesystems (and expected in the attr test suite).
Comment 1 David Sterba 2015-03-17 14:46:27 UTC
Do you have a reproducer?

$ touch file
$ setfattr -n btrfs. -v 1 file

straced, shows that it does not pass:

setxattr("file", "btrfs.", "1", 1, 0)   = -1 EINVAL (Invalid argument)
Comment 2 William Douglas 2015-03-17 16:44:46 UTC
Yes sorry I didn't include that.

Your example fails because the attributes have to have a valid prefix (see xattr.c:330 btrfs_is_valid_xattr for the prefixes allowed).

$ touch file
$ setfattr -n user. -v 1 file
$ getfattr file
# file: file
user.
Comment 3 David Sterba 2015-03-25 18:27:31 UTC
Fixed by:

https://patchwork.kernel.org/patch/6094101/

Note You need to log in before you can comment on or make changes to this bug.