aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-12-16 08:19:39 +0000
committerChristian Brauner <brauner@kernel.org>2025-12-24 13:52:50 +0100
commit3dd57ddec9e3a98387196a3f53b8c036977d8c0f (patch)
tree461a0da665f1e61d9d0f9ee4b70815e890a241ad
parent73a91ef328a9d728c7f3357f925980937f0d520c (diff)
get rid of bogus __user in struct xattr_args::value
The first member of struct xattr_args is declared as __aligned_u64 __user value; which makes no sense whatsoever; __user is a qualifier and what that declaration says is "all struct xattr_args instances have .value _stored_ in user address space, no matter where the rest of the structure happens to be". Something like "int __user *p" stands for "value of p is a pointer to an instance of int that happens to live in user address space"; it says nothing about location of p itself, just as const char *p declares a pointer to unmodifiable char rather than an unmodifiable pointer to char. With xattr_args the intent clearly had been "the 64bit value represents a _pointer_ to object in user address space", but __user has nothing to do with that. All it gets us is a couple of bogus warnings in fs/xattr.c where (userland) instance of xattr_args is copied to local variable of that type (in kernel address space), followed by access to its members. Since we've told sparse that args.value must somehow be located in userland memory, we get warned that looking at that 64bit unsigned integer (in a variable already on kernel stack) is not allowed. Note that sparse has no way to express "this integer shall never be cast into a pointer to be dereferenced directly" and I don't see any way to assign a sane semantics to that. In any case, __user is not it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://patch.msgid.link/20251216081939.GQ1712166@ZenIV Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r--include/uapi/linux/xattr.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h
index c7c85bb504ba..2e5aef48fa7e 100644
--- a/include/uapi/linux/xattr.h
+++ b/include/uapi/linux/xattr.h
@@ -23,7 +23,7 @@
#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
struct xattr_args {
- __aligned_u64 __user value;
+ __aligned_u64 value;
__u32 size;
__u32 flags;
};