Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Aug 2022 04:46:09 +0000
From:      bugzilla-noreply@freebsd.org
To:        testing@FreeBSD.org
Subject:   [Bug 266112] Capsicum extended attributes test failing on ZFS
Message-ID:  <bug-266112-32464@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266112

            Bug ID: 266112
           Summary: Capsicum extended attributes test failing on ZFS
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: tests
          Assignee: testing@FreeBSD.org
          Reporter: sigsys@gmail.com

sys/capsicum/functional:test_unprivileged (internal test
Capability.ExtendedAttributesIfAvailableForked) fails when running with a Z=
FS
/tmp since OpenZFS started rejecting attribute names with certain prefixes.

It uses compatibility wrappers for the Linux syscalls.  They're only ever
called with "user.*" attribute names, and they always assume that the user
namespace is to be used, but they don't bother stripping the prefix from the
name passed the FreeBSD syscalls.

diff --git i/contrib/capsicum-test/syscalls.h
w/contrib/capsicum-test/syscalls.h
index 592a1677e1f1..3ea8803c2f64 100644
--- i/contrib/capsicum-test/syscalls.h
+++ w/contrib/capsicum-test/syscalls.h
@@ -47,16 +47,29 @@ inline int bogus_mount_() {

 /* Mappings for extended attribute functions */
 #include <sys/extattr.h>
+#include <errno.h>
+static const char *fbsd_extattr_skip_prefix(const char *p) {
+  if (*p++ =3D=3D 'u' && *p++ =3D=3D 's' && *p++ =3D=3D 'e' && *p++ =3D=3D=
 'r' && *p++ =3D=3D '.')
+    return p;
+  errno =3D EINVAL;
+  return NULL;
+}
 inline ssize_t flistxattr_(int fd, char *list, size_t size) {
   return extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, list, size);
 }
 inline ssize_t fgetxattr_(int fd, const char *name, void *value, size_t si=
ze)
{
+  if (!(name =3D fbsd_extattr_skip_prefix(name)))
+    return -1;
   return extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
 }
 inline int fsetxattr_(int fd, const char *name, const void *value, size_t
size, int) {
+  if (!(name =3D fbsd_extattr_skip_prefix(name)))
+    return -1;
   return extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
 }
 inline int fremovexattr_(int fd, const char *name) {
+  if (!(name =3D fbsd_extattr_skip_prefix(name)))
+    return -1;
   return extattr_delete_fd(fd, EXTATTR_NAMESPACE_USER, name);
 }

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-266112-32464>