git: 11e37048db35 - main - linux(4): Return ENOTSUP from listxattr instead of EPERM
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Sep 2023 08:53:54 UTC
The branch main has been updated by dchagin:
URL: https://cgit.FreeBSD.org/src/commit/?id=11e37048db35d7fcfc285b867965de1aeefec2c8
commit 11e37048db35d7fcfc285b867965de1aeefec2c8
Author: Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-09-05 08:52:27 +0000
Commit: Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-09-05 08:52:27 +0000
linux(4): Return ENOTSUP from listxattr instead of EPERM
FreeBSD does not permits manipulating extended attributes in the system
namespace by unprivileged accounts, even if account has appropriate
privileges to access filesystem object.
In Linux the system namespace is used to preserve posix acls. Some Gnu
coreutils binaries uses posix acls, eg, install, ls, cp. And fails if
we unexpectedly return EPERM error from xattr system calls.
In the other hands, in Linux read and write access to the system
namespace depend on the policy implemented for each filesystem, so we'll
mimics we're a filesystem that prohibits this for unpriveleged accounts.
Reported by: zirias
Tested by: zirias
MFC after: 1 week
---
sys/compat/linux/linux_xattr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c
index 71d7ae58439e..6979fff9c82d 100644
--- a/sys/compat/linux/linux_xattr.c
+++ b/sys/compat/linux/linux_xattr.c
@@ -165,6 +165,8 @@ listxattr(struct thread *td, struct listxattr_args *args)
error = kern_extattr_list_fd(td, args->fd,
attrnamespace, &auio);
rs = sz - auio.uio_resid;
+ if (error == EPERM)
+ break;
if (error != 0 || rs == 0)
continue;
prefix = extattr_namespace_names[attrnamespace];