Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setxattr is broken #730

Closed
limetech opened this issue Feb 7, 2023 · 3 comments
Closed

setxattr is broken #730

limetech opened this issue Feb 7, 2023 · 3 comments
Labels

Comments

@limetech
Copy link

limetech commented Feb 7, 2023

Likely this commit:
7f430a3

The 'name' string passed to fs->op.setxattr has the first 8 characters missing. Using the 'passthrough' example, start it up and try:

setfattr -n user.myxattr -v myvalue /xmp/somefile
setfattr: /xmp/somefile: Operation not supported

This is because the string seen by xmp_setxattr() is "attr" instead of "user.myxattr".

To prove the name pointer is off by 8 bytes, inside xmp_setxattr() this works to change:
int res = lsetxattr(path, name, value, size, flags);
to
int res = lsetxattr(path, (char *)(name-8), value, size, flags);

@Nikratio
Copy link
Contributor

Nikratio commented Feb 9, 2023

Thanks for the report! Pull requests are welcome :-).

@Nikratio
Copy link
Contributor

I can confirm the problem. It seems to affect only setxattr, not getxattr:

# example/passthrough_ll -o debug,source=/tmp,xattr ~/tmp/mnt &
[....]
# setfattr -n user.foobar -v terminate ~/tmp/mnt/tmpy12rqp1r
unique: 534, opcode: SETXATTR (21), nodeid: 140044455121248, insize: 69, pid: 2080913
lo_setxattr(ino=140044455121248, name=bar value=terminate size=9)
   unique: 534, error: -95 (Operation not supported), outsize: 16

# getfattr -n user.foobar  ~/tmp/mnt/tmpy12rqp1r
unique: 548, opcode: GETXATTR (22), nodeid: 140044455121248, insize: 60, pid: 2081099
lo_getxattr(ino=140044455121248, name=user.foobar size=0)
   unique: 548, error: -95 (Operation not supported), outsize: 16

@Nikratio
Copy link
Contributor

Reverting commit 7f430a3 fixes the problem (though it's not immediately obvious to me why).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants