From owner-freebsd-emulation Fri Nov 16 8:59: 2 2001 Delivered-To: freebsd-emulation@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 60C6C37B405 for ; Fri, 16 Nov 2001 08:58:59 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 16 Nov 2001 16:58:58 +0000 (GMT) To: Dag-Erling Smorgrav Cc: Takanori Saneto , emulation@FreeBSD.ORG Subject: Re: Linuxulator MFC and VMware In-Reply-To: Your message of "16 Nov 2001 16:38:40 +0100." Date: Fri, 16 Nov 2001 16:58:57 +0000 From: Ian Dowse Message-ID: <200111161658.aa21165@salmon.maths.tcd.ie> Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In message , Dag-Erling Smorgrav writes: >+ switch (args->cmd) { >+ case LINUX_SIOCGIFADDR: >+ case LINUX_SIOCSIFADDR: >+ error = ioctl(td, (struct ioctl_args *)args); >+ break; See my earlier post to -emulation. The if_tap/vmnet driver bogusly uses FreeBSD's definition of SIOCGIFADDR/SIOCGIFADDR/SIOCSIFADDR for ioctls that do not use a `struct ifreq'. It was just fluke that it worked before, because the linux emulation code must have translated between the Linux and FreeBSD versions without any error checking. It's also just fluke that the 2-byte and 6-byte data that vmware passed in happened to not be near enough to an unmapped page for ioctl() to fail on the copyin/copyout. Whatever the correct solution, if_tap/vmnet should be changed to define it's own ioctl numbers with the correct lengths, and something at the linux emulation layer (probably linux_emu.c in vmmon.ko) should translate. I think the above patch would work (in the old bogus sense) if you add translation from the Linux ioctl numbers to FreeBSD numbers, but I don't think it can work as it is. Because of the major difference between the way Linux and FreeBSD interpret ioctl numbers, it never makes sense to pass on a Linux args->cmd to FreeBSD's ioctl() without translation. The most useful approach is to return ENOIOCTL from the handler unless you are certain that you can deal with the ioctl correctly. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message