Subject: kern/21936: compat/linux: ioctl 'r' misinterpreted
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/19/2003 23:37:45
>Number:         21936
>Category:       kern
>Synopsis:       compat/linux: ioctl 'r' misinterpreted
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 20 03:39:00 UTC 2003
>Originator:     Todd Vierling
>Release:        NetBSD 1.6.1_STABLE
	DUH.ORG:  Pointing out the obvious since 1994.
System: NetBSD 1.6.1_STABLE NetBSD 1.6.1_STABLE (HOME) #2: Wed May 21 13:10:29 EDT 2003 i386
Architecture: i386
Machine: i386

The ioctl family 'r' represents the VFAT_ family from <linux/msdos_fs.h> on
Linux, but it represents several completely unrelated things on NetBSD.  As
a result, programs (such as Wine binaries for Linux) get a wrong value back
from ioctl(2) for these ioctls.



    ioctl(fd, VFAT_IOCTL_READDIR_BOTH, buf);

under NetBSD's Linux emulation, where "fd" is an open directory fd, and
"buf" points to at least 48 bytes of storage.  Expect -1/EINVAL to be
returned because of the unimplemented compatibility.  Be shocked that a
real nonnegative value is returned by ioctl() and the buf is unfilled.


Trivial.  Request pullup to 1.6 branch; this change is one of several
that are needed to make CrossOver Office run on NetBSD.

Index: compat/linux/common/linux_ioctl.c
RCS file: /cvsroot/src/sys/compat/linux/common/linux_ioctl.c,v
retrieving revision 1.28
diff -u -r1.28 linux_ioctl.c
--- compat/linux/common/linux_ioctl.c	2001/11/13 02:08:53	1.28
+++ compat/linux/common/linux_ioctl.c	2003/06/20 03:31:43
@@ -131,6 +131,8 @@
 			return linux_ioctl_termios(p, uap, retval);
+	case 'r': /* VFAT ioctls; not yet supported */
+		return (EINVAL);
 	case 0x89:
 		return linux_ioctl_socket(p, uap, retval);
 	case 0x03: