xattr-util: try new *xattrat() family syscalls first

Added in https://github.com/torvalds/linux/commit/6140be90ec70c39fa844741ca3cc807dd0866394

However, when O_PATH fds are encountered we'd have to go by
/proc/self/fd/ still, since the kernel people are reluctant
to make the new syscalls work with them
(https://lore.kernel.org/linux-fsdevel/20250206-steril-raumplanung-733224062432@brauner/)
Hence getxattrat() and listxattrat() are not employed.

While at it, remove the discrepancy between path being NULL
and empty - I don't grok the "security issue" claimed earlier,
but nowadays even the kernel treats the two as identical:
https://github.com/torvalds/linux/commit/e896474fe4851ffc4dd860c92daa906783090346
This commit is contained in:
Mike Yuan
2025-02-09 14:51:04 +01:00
parent baca3581ea
commit b8df25dcfe
5 changed files with 323 additions and 225 deletions
+1 -2
View File
@@ -1679,8 +1679,7 @@ int copy_xattr(int df, const char *from, int dt, const char *to, CopyFlags copy_
if (r < 0)
return r;
if (xsetxattr(dt, to, p, value, r, 0) < 0)
ret = -errno;
RET_GATHER(ret, xsetxattr_full(dt, to, /* at_flags = */ 0, p, value, r, /* xattr_flags = */ 0));
}
return ret;