Commit graph

9 commits

Author SHA1 Message Date
Dmitry Chagin
e975d1b725 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

(cherry picked from commit 11e37048db35d7fcfc285b867965de1aeefec2c8)
2023-09-11 14:59:38 +03:00
Dmitry Chagin
53b3e15d73 linux(4): Fix listxattr for the case when the size is 0
If size is specified as zero, these calls return the current size
of the list of extended attribute names (and leave list unchanged).

Tested by:		zirias
MFC after:		1 week

(cherry picked from commit 18d1c86788f66f42c4e096142f4f8d168f68732c)
2023-09-11 14:59:38 +03:00
Dmitry Chagin
bce9c2e340 linux(4): Return ENOTSUP from xattr syscalls 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.  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

(cherry picked from commit 1bfc4574f78653e4b64ac9dd31518c96a17fe52b)
2023-09-11 14:59:38 +03:00
Dmitry Chagin
0f35bf8b29 linux(4): Merge removexattr for future error recode
Tested by:		zirias
MFC after:		1 week

(cherry picked from commit dfcc0237c3a97f4f7962da854389f3c5d976145a)
2023-09-11 14:59:38 +03:00
Dmitry Chagin
a9b8a0ced4 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.

Reported by:		zirias
PR:			273517
Tested by:		zirias
MFC after:		1 week

(cherry picked from commit 4d59b790553ef75b9a4b6a673eab3354f3d012b3)
2023-09-11 14:58:50 +03:00
Dmitry Chagin
803280ea07 linux(4): Merge getxattr for future error recode
Tested by:		zirias
MFC after:		1 week

(cherry picked from commit 6b46ec66129d9490c91876f72d98e514121996a6)
2023-09-11 14:58:50 +03:00
Dmitry Chagin
3460fab5fc linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743 2023-08-18 13:12:02 +03:00
Warner Losh
685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Dmitry Chagin
22dca7acf7 linux(4): Implement xattr syscalls
Reviewed by:
Differential revision:	https://reviews.freebsd.org/D35544
MFC after:		1 month
2023-07-22 14:03:33 +03:00