git: 01d9f0eebf8d - releng/14.0 - linux(4): Return ENODATA from getxattr syscalls instead of EPERM

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Tue, 12 Sep 2023 16:44:10 UTC
The branch releng/14.0 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=01d9f0eebf8dceddc465fecac919c1e9d7a586a2

commit 01d9f0eebf8dceddc465fecac919c1e9d7a586a2
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-09-01 08:10:12 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-09-12 16:42:31 +0000

    linux(4): Return ENODATA from getxattr syscalls instead of EPERM
    
    On Linux ENODATA mean the named attribute does not exist, or the
    process has no access to this attribute.
    
    Approved by:            re (gjb)
    Reported by:            zirias
    PR:                     273517
    Tested by:              zirias
    MFC after:              1 week
    
    (cherry picked from commit 4d59b790553ef75b9a4b6a673eab3354f3d012b3)
    (cherry picked from commit a9b8a0ced46efe72ec118a749d191b29ce47712b)
---
 sys/compat/linux/linux_xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c
index 901123684154..b9717c62133c 100644
--- a/sys/compat/linux/linux_xattr.c
+++ b/sys/compat/linux/linux_xattr.c
@@ -285,7 +285,7 @@ getxattr(struct thread *td, struct getxattr_args *args)
 	else
 		error = kern_extattr_get_fd(td, args->fd, attrnamespace,
 		    attrname, args->value, args->size);
-	return (error);
+	return (error == EPERM ? ENOATTR : error);
 }
 
 int