Date: Fri, 16 Nov 2001 16:58:57 +0000 From: Ian Dowse <iedowse@maths.tcd.ie> To: Dag-Erling Smorgrav <des@ofug.org> Cc: Takanori Saneto <sanewo@ba2.so-net.ne.jp>, emulation@FreeBSD.ORG Subject: Re: Linuxulator MFC and VMware Message-ID: <200111161658.aa21165@salmon.maths.tcd.ie> In-Reply-To: Your message of "16 Nov 2001 16:38:40 %2B0100." <xzp668apvy7.fsf@flood.ping.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <xzp668apvy7.fsf@flood.ping.uio.no>, 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200111161658.aa21165>