Skip to contentSkip to conversation

BUG? atleast >=2.6.19-rc5, x86 chroot on x86_64

DISCUSSION Chuck Ebbert 2 participants 2 messages Dec 5, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 6 lines · David Howells
Quoted 2 lines

Here is a patch to reverse that. Kasper, can you test it? (Your filesystem is on a FAT/VFAT volume, I assume.)

Please don't revert that patch. If you do, you'll break CONFIG_BLOCK=n.

Can you compile and run the attached program as both 32-bit and 64-bit?

I only have 32-bit userspace. When I run your program against a directory on a JFS filesystem (msdos ioctls not supported) I get this on vanilla 2.6.19:

$ ./vfat_ioctl32.ex .
268 : 82187201, 82187202
268 : 82187201, 82187202
Calling VFAT_IOCTL_READDIR_BOTH32
ioctl: Invalid argument
Calling VFAT_IOCTL_READDIR_BOTH
ioctl: Invalid argument

After reverting the msdos compat ioctls patch it changes to:

$ ./vfat_ioctl32.ex .
268 : 82187201, 82187202
268 : 82187201, 82187202
Calling VFAT_IOCTL_READDIR_BOTH32
ioctl: Inappropriate ioctl for device
Calling VFAT_IOCTL_READDIR_BOTH
ioctl: Inappropriate ioctl for device
Quoted 10 lines
| i have only tested with >=rc5, thw folling, as an example, appears in
| dmesg:
| ioctl32(regedit.exe:11801): Unknown cmd fd(9) cmd(82187201){02}
| arg(00221000) on /home/redeeman
| ioctl32(regedit.exe:11801): Unknown cmd fd(9) cmd(82187201){02}
| arg(00221000) on /home/redeeman/.wine/drive_c/windows/system32
| ioctl32(regedit.exe:11801): Unknown cmd fd(9) cmd(82187201){02}
| arg(00221000) on /home/redeeman/.wine/drive_c/windows/system

How do you get that?

I get those messages when the ioctl call returns 'invalid argument.'

In fs/compat.s::compat_sys_ioctl() you can see it changing the return value after it prints the message:

                static int count;

                if (++count <= 50)
                        compat_ioctl_error(filp, fd, cmd, arg);
                error = -EINVAL;

So apparently this is a feature?

Signature · 2 lines
Chuck
"Even supernovas have their duller moments."
#1 lore raw
Quoted 3 lines · Chuck Ebbert

I only have 32-bit userspace. When I run your program against a directory on a JFS filesystem (msdos ioctls not supported) I get this on vanilla 2.6.19:

Can I just check? You're using an x86_64 CPU in 64-bit mode with a 64-bit kernel, but with a completely 32-bit userspace?

Quoted 3 lines

I only have 32-bit userspace. When I run your program against a directory on a JFS filesystem (msdos ioctls not supported) I get this on vanilla 2.6.19:

Wait! You're using JFS, not VFAT? Oh... I see.

Okay: It's not the MSDOS/VFAT patch that's wrong. Please don't revert that. It's the compat ioctl code that's "wrong".

So compat_sys_ioctl() used to return ENOTTY (ENOIOCTLCMD internally) because the MSDOS ioctl was listed as one that could be translated but it didn't apply to JFS.

But now, since all the block-based filesystem ioctls have been removed from that list, you now get EINVAL, not ENOTTY.

Quoted 1 line

So apparently this is a feature?

Unfortunately, I think it has to be. We could add a master list of ioctls to be issued with particular errors if the driver doesn't support them, but is it worth it?

A question for you: Why is userspace assuming that it'll get ENOTTY rather than EINVAL?

David