zfs returns enosys when calling fsetxattr

Bug #1755499 reported by Thadeu Lima de Souza Cascardo
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
High
Colin Ian King
Bionic
Fix Released
High
Colin Ian King
stress-ng (Ubuntu)
Invalid
Undecided
Unassigned
Bionic
Invalid
Undecided
Unassigned

Bug Description

When xfstests are run on zfs, they expect acl calls (like fsetxattr) to either work or return ENOTSUP. zfs fails with ENOSYS, at least on arm64.

The result on calling the immutable tests of xfstests are:

acl: Function not implemented

Tags: patch
Changed in stress-ng (Ubuntu):
status: New → Invalid
Changed in linux (Ubuntu Bionic):
assignee: nobody → Colin Ian King (colin-king)
status: New → Confirmed
Changed in linux (Ubuntu Bionic):
status: Confirmed → In Progress
importance: Undecided → High
Revision history for this message
Colin Ian King (colin-king) wrote :

@Thadeu, I'm having issues trying to reproduce this, which specific test is being run?

Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :
Revision history for this message
Colin Ian King (colin-king) wrote :

Thanks, I'll ask Sam for access to that H/W tomorrow.

Revision history for this message
Colin Ian King (colin-king) wrote :

Issue exists with 4.15 + today's upstream zfs v0.7.0-378_ga76f3d043

Revision history for this message
Colin Ian King (colin-king) wrote :

Does not occur with x86 ZFS on 4.15.

Revision history for this message
Colin Ian King (colin-king) wrote :

This also fails on ARM64 + ZFS 0.6.5.11-1ubuntu3.1 + 4.13.0-37-generic

Revision history for this message
Colin Ian King (colin-king) wrote :

And also ARM64 + 4.4.0-116-generic. I wonder why this used to pass.

Revision history for this message
Colin Ian King (colin-king) wrote :

arm64:

statfs("/mnt/scratch/079", {f_type=ZFS_SUPER_MAGIC, f_bsize=131072, f_blocks=15097, f_bfree=15097, f_bavail=15097, f_files=3864945, f_ffree=3864939, f_fsid={val=[2326582274, 8984039]}, f_namelen=255, f_frsize=131072, f_flags=ST_VALID|ST_RELATIME}) = 0
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR|O_TRUNC) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY|O_TRUNC) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR|O_APPEND) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY|O_APPEND) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR|O_TRUNC|O_APPEND) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY|O_TRUNC|O_APPEND) = -1 EACCES (Permission denied)
truncate("/mnt/scratch/079/immutable.f", 0) = -1 EACCES (Permission denied)
utimensat(AT_FDCWD, "/mnt/scratch/079/immutable.f", [{tv_sec=0, tv_nsec=0}, {tv_sec=0, tv_nsec=0}], 0) = -1 EPERM (Operation not permitted)
utimensat(AT_FDCWD, "/mnt/scratch/079/immutable.f", NULL, 0) = -1 EPERM (Operation not permitted)

x86:
statfs("/mnt/scratch/079", {f_type=ZFS_SUPER_MAGIC, f_bsize=131072, f_blocks=15102, f_bfree=15102, f_bavail=15102, f_files=3866273, f_ffree=3866267, f_fsid={val=[4130572324, 1396799]}, f_namelen=255, f_frsize=131072, f_flags=ST_VALID|ST_RELATIME}) = 0
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR|O_TRUNC) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY|O_TRUNC) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR|O_APPEND) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY|O_APPEND) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_RDWR|O_TRUNC|O_APPEND) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/mnt/scratch/079/immutable.f", O_WRONLY|O_TRUNC|O_APPEND) = -1 EPERM (Operation not permitted)
truncate("/mnt/scratch/079/immutable.f", 0) = -1 EPERM (Operation not permitted)
utime("/mnt/scratch/079/immutable.f", {actime=0, modtime=0}) = -1 EPERM (Operation not permitted)
utime("/mnt/scratch/079/immutable.f", NULL) = -1 EPERM (Operation not permitted)

Revision history for this message
Colin Ian King (colin-king) wrote :

Looking at the termination of t_immutable test program:

ARM:
mprotect(0xffff86092000, 4096, PROT_READ) = 0
mprotect(0xffff860b3000, 4096, PROT_READ) = 0
munmap(0xffff86295000, 38279) = 0
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
lseek(4, 0, SEEK_CUR) = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=1682, ...}) = 0
mmap(NULL, 1682, PROT_READ, MAP_SHARED, 4, 0) = 0xffff8629e000
lseek(4, 1682, SEEK_SET) = 1682
munmap(0xffff8629e000, 1682) = 0
close(4) = 0
dup(2) = 4
fcntl(4, F_GETFL) = 0x20002 (flags O_RDWR|0x20000)
fstat(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
write(4, "acl: Function not implemented\n", 30acl: Function not implemented
) = 30
close(4) = 0
exit_group(1) = ?
+++ exited with 1 +++

x86 at same place:
mprotect(0x7f677e46f000, 4096, PROT_READ) = 0
mprotect(0x7f677e67d000, 4096, PROT_READ) = 0
munmap(0x7f677f097000, 165753) = 0
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
lseek(4, 0, SEEK_CUR) = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=3023, ...}) = 0
mmap(NULL, 3023, PROT_READ, MAP_SHARED, 4, 0) = 0x7f677f0bf000
lseek(4, 3023, SEEK_SET) = 3023
munmap(0x7f677f0bf000, 3023) = 0
close(4) = 0
fsetxattr(3, "system.posix_acl_access", "\2\0\0\0\1\0\6\0\377\377\377\377\2\0\6\0\376\377\0\0\4\0\6\0\377\377\377\377\20\0\6", 44, 0) = -1 EOPNOTSUPP (Operation not supported)
fsetxattr(3, "trusted.test", "readonly", 8, XATTR_CREATE) = 0
fsetxattr(3, "user.test", "readonly", 8, XATTR_CREATE) = 0
..etc

So it's something different in the test program in the acl handling side

Revision history for this message
Colin Ian King (colin-king) wrote :

#0 __GI___libc_write (fd=4, buf=0xaaaaaaacbc40, nbytes=30) at ../sysdeps/unix/sysv/linux/write.c:25
#1 0x0000ffffb7ebf878 in _IO_new_file_write (f=0xaaaaaaac9850, data=0xaaaaaaacbc40, n=30) at fileops.c:1255
#2 0x0000ffffb7ebec28 in new_do_write (fp=0xaaaaaaac9850, data=0xaaaaaaacbc40 "acl: Function not implemented\n", to_do=to_do@entry=30) at fileops.c:510
#3 0x0000ffffb7ec0994 in _IO_new_do_write (fp=<optimized out>, data=<optimized out>, to_do=30) at fileops.c:486
#4 0x0000ffffb7ebff6c in _IO_new_file_xsputn (f=0xaaaaaaac9850, data=<optimized out>, n=1) at fileops.c:1323
#5 0x0000ffffb7e97064 in _IO_vfprintf_internal (s=0xaaaaaaac9850, format=0xffffb7f76008 "%s%s%s\n", ap=...) at vfprintf.c:1674
#6 0x0000ffffb7eb2180 in locked_vfxprintf (fp=fp@entry=0xaaaaaaac9850, fmt=<optimized out>, ap=...) at fxprintf.c:30
#7 0x0000ffffb7eb22e0 in __fxprintf (fp=fp@entry=0xaaaaaaac9850, fmt=fmt@entry=0xffffb7f76008 "%s%s%s\n") at fxprintf.c:74
#8 0x0000ffffb7eaf588 in perror_internal (fp=fp@entry=0xaaaaaaac9850, s=s@entry=0xaaaaaaab64d0 "acl", errnum=errnum@entry=38) at perror.c:39
#9 0x0000ffffb7eaf65c in __GI_perror (s=0xaaaaaaab64d0 "acl") at perror.c:74
#10 0x0000aaaaaaab256c in create_test_area (dir=0xfffffffff886 "foo") at t_immutable.c:2008
#11 0x0000aaaaaaaaba88 in main (argc=3, argv=0xfffffffff638) at t_immutable.c:2277

Revision history for this message
Colin Ian King (colin-king) wrote :

debugged further into fadd_acl, this calls acl_set_fd libacl/acl_set_fd.c:47, and this calls:

fsetxattr (filedes=filedes@entry=3, name=name@entry=0xaaaaaaab6958 "system.posix_acl_access", value=value@entry=0xaaaaaaacbc00, size=<optimized out>, flags=flags@entry=0)

..which returns -1 and errno = 38 (ENOSYS 38 Function not implemented)

this also occurs on a non-ZFS file system (e.g. ext4).

Revision history for this message
Colin Ian King (colin-king) wrote :

Looks like the wrapper in xfstests-bld/attr/libattr/syscalls.c returns the dreaded ENOSYS becuase XATTR_SYSCALLS is not defined. Silent and deadly.

#if HAVE_XATTR_SYSCALLS
# define SYSCALL(args...) syscall(args)
#else
# define SYSCALL(args...) ( errno = ENOSYS, -1 )
#endif

Revision history for this message
Colin Ian King (colin-king) wrote :

..and HAVE_XATTR_SYSCALLS is not defined because it does not have arch specific #defines for arm64. I'll add them in tomorrow and fix this up.

Revision history for this message
Colin Ian King (colin-king) wrote :

Attached is a fix to the tests, hopefully will be added to the autotest-client-tests repo ASAP.

tags: added: patch
Revision history for this message
Colin Ian King (colin-king) wrote :
Changed in linux (Ubuntu Bionic):
status: In Progress → Fix Committed
Revision history for this message
Colin Ian King (colin-king) wrote :

@Thadeu, do you mind re-testing this as the fix has now landed in autotests

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Possible duplicate: arm64 system failed with test 079 in zfs_xfs_generic
bug 1732370

Revision history for this message
Colin Ian King (colin-king) wrote :

Yes, 1732370 is a duplicate, marked it as so.

Revision history for this message
Colin Ian King (colin-king) wrote :
Changed in linux (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.