Subject: kern/21936: compat/linux: ioctl 'r' misinterpreted
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tv@pobox.com>
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
>Closed-Date:
>Last-Modified:
>Originator:     Todd Vierling
>Release:        NetBSD 1.6.1_STABLE
>Organization:
	DUH.ORG:  Pointing out the obvious since 1994.
>Environment:
System: NetBSD server.duh.org 1.6.1_STABLE NetBSD 1.6.1_STABLE (HOME) #2: Wed May 21 13:10:29 EDT 2003 tv@server.duh.org:/export/SRC/duh/netbsd-kernels/HOME i386
Architecture: i386
Machine: i386
>Description:

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.

>How-To-Repeat:

Call

    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.

>Fix:

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 @@
 #endif
 			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:
>Release-Note:
>Audit-Trail:
>Unformatted: