[Bug 251035] ZFS: Allow 64 bit ZFS to support 32 bit ioctls (Wine)

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 17 Aug 2021 00:55:39 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251035

--- Comment #4 from Damjan Jovanovic <damjan.jov_at_gmail.com> ---
(In reply to Kubilay Kocak from comment #3)

That code has changed a lot in FreeBSD 13 and upstream.

32 bit "zpool list" still crashes, as per truss:

21250: openat(AT_FDCWD,"/dev/zfs",O_RDWR,00)     = 5 (0x5)
21250: ioctl(3,0xc0145a04 { IORW 0x5a('Z'), 4, 20 },0xffffb338) ERR#22 'Invalid
argument'

where /var/log/messages has:

Aug 17 02:37:31 pc kernel: len 20 vecnum: 4 sizeof (zfs_cmd_t) 4528

probably from:

        if (len != sizeof (zfs_iocparm_t)) {
                printf("len %d vecnum: %d sizeof (zfs_cmd_t) %ju\n",
                    len, vecnum, (uintmax_t)sizeof (zfs_cmd_t));
                return (EINVAL);
        }

in sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c

That has another bug in logging, as zfs_iocparm_t and zfs_cmd_t are different
structs. We should be printing sizeof(zfs_iocparm_t), not sizeof(zfs_cmd_t).

This bug probably doesn't affect Linux, as it uses zfs_cmd_t directly, which
has the same field sizes/alignments on 32 and 64 bit already. We wrap zfs_cmd_t
in our zfs_iocparm_t, and add this bug in the process.

It will take me a while to test a new patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Tue Aug 17 2021 - 00:55:39 UTC

Original text of this message