Date: Wed, 11 Nov 2020 06:35:59 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 251035] [zfs][patch] allow 64 bit zfs to support 32 bit ioctls (Wine) Message-ID: <bug-251035-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D251035 Bug ID: 251035 Summary: [zfs][patch] allow 64 bit zfs to support 32 bit ioctls (Wine) Product: Base System Version: 12.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: damjan.jov@gmail.com Created attachment 219540 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D219540&action= =3Dedit convert 32 bit zfs_iocparm_t to 64 bit When 32 bit applications use libzfs to access ZFS data, they always fail in zfs_open(), with 32 bit "zfs list" and "zpool list" crashing. This is because /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c function zfsdev_ioctl() checks for: ---snip--- if (len !=3D sizeof(zfs_iocparm_t)) { ---snip--- On amd64, sizeof(zfs_iocparm_t) is 24, as in /usr/src/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h we have: ---snip--- typedef struct zfs_iocparm { uint32_t zfs_ioctl_version; uint64_t zfs_cmd; uint64_t zfs_cmd_size; } zfs_iocparm_t; ---snip--- which has its fields aligned to 8 byte boundaries. On i386, they are aligne= d to 4 byte boundaries, sizeof(zfs_iocparm_t) is only 20, and every ioctl fails = with EINVAL. This affects Wine as it runs many 32 bit apps. Since Windows is case-insensitive, Wine has to slowly scan the entire directory when doing f= ile I/O on a case-sensitive filesystem, to match filenames case-insensitively. = ZFS can create filesystems with casesensitivity=3Dinsensitive, allowing Wine to= skip the slow scan and speeding up file I/O considerably for some apps. When developing a patch to Wine to check that casesensitivity property and use it when insensitive (https://source.winehq.org/patches/data/195726) I noticed zfs_open() always fails, which led me to this bug. The attached patch correctly converts the 32 bit zfs_iocparm_t to 64 bit, a= nd allows at least Wine to work correctly. I haven't yet had a chance to test whether it fixes 32 bit versions of the "zpool" and "zfs" tools (which prob= ably use more elaborate ioctls). --=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-251035-227>