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:
+21
-4
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "time-util.h"
|
||||
|
||||
int getxattr_at_malloc(int fd, const char *path, const char *name, int flags, char **ret);
|
||||
int getxattr_at_malloc(int fd, const char *path, const char *name, int at_flags, char **ret);
|
||||
static inline int getxattr_malloc(const char *path, const char *name, char **ret) {
|
||||
return getxattr_at_malloc(AT_FDCWD, path, name, AT_SYMLINK_FOLLOW, ret);
|
||||
}
|
||||
@@ -18,9 +18,9 @@ static inline int fgetxattr_malloc(int fd, const char *name, char **ret) {
|
||||
return getxattr_at_malloc(fd, NULL, name, AT_EMPTY_PATH, ret);
|
||||
}
|
||||
|
||||
int getxattr_at_bool(int fd, const char *path, const char *name, int flags);
|
||||
int getxattr_at_bool(int fd, const char *path, const char *name, int at_flags);
|
||||
|
||||
int listxattr_at_malloc(int fd, const char *path, int flags, char **ret);
|
||||
int listxattr_at_malloc(int fd, const char *path, int at_flags, char **ret);
|
||||
static inline int listxattr_malloc(const char *path, char **ret) {
|
||||
return listxattr_at_malloc(AT_FDCWD, path, AT_SYMLINK_FOLLOW, ret);
|
||||
}
|
||||
@@ -31,7 +31,24 @@ static inline int flistxattr_malloc(int fd, char **ret) {
|
||||
return listxattr_at_malloc(fd, NULL, AT_EMPTY_PATH, ret);
|
||||
}
|
||||
|
||||
int xsetxattr(int fd, const char *path, const char *name, const char *value, size_t size, int flags);
|
||||
int xsetxattr_full(
|
||||
int fd,
|
||||
const char *path,
|
||||
int at_flags,
|
||||
const char *name,
|
||||
const char *value,
|
||||
size_t size,
|
||||
int xattr_flags);
|
||||
static inline int xsetxattr(
|
||||
int fd,
|
||||
const char *path,
|
||||
int at_flags,
|
||||
const char *name,
|
||||
const char *value) {
|
||||
return xsetxattr_full(fd, path, at_flags, name, value, SIZE_MAX, 0);
|
||||
}
|
||||
|
||||
int xremovexattr(int fd, const char *path, int at_flags, const char *name);
|
||||
|
||||
int fd_setcrtime(int fd, usec_t usec);
|
||||
int getcrtime_at(int fd, const char *path, int at_flags, usec_t *ret);
|
||||
|
||||
Reference in New Issue
Block a user