Date: Tue, 28 Jun 2011 03:20:26 GMT From: Paul Procacci <pprocacci@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: amd64/158369: ioctl SIOCGIFCONF in chroot bug? Message-ID: <201106280320.p5S3KQqu069145@red.freebsd.org> Resent-Message-ID: <201106280330.p5S3UHJe076702@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 158369 >Category: amd64 >Synopsis: ioctl SIOCGIFCONF in chroot bug? >Confidential: no >Severity: critical >Priority: low >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 28 03:30:16 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Paul Procacci >Release: 8.2-STABLE >Organization: >Environment: FreeBSD work_machine.myhome 8.2-STABLE FreeBSD 8.2-STABLE #1: Mon Jun 27 18:51:19 CDT 2011 root@work_machine.myhome:/usr/obj/usr/src/sys/WORK_MACHINE amd64 >Description: chroot'd applications within a i386 environment (amd64 host) that utilize: ################################ ioctl(fd, SIOCGIFCONF, ifc); ################################ ...aren't working properly. It's seems the ifc_len member of the ifconf structure never gets updated. Utilizing fresh installs of both amd64 and i386 everything seems to work fine. However when running this with a chroot'd i386 install on a amd64 host, it fails miserably. This came up with trying to get wine working with a game. Here is a reference to the related wine bug that I filed: http://bugs.winehq.org/show_bug.cgi?id=27614 Thoughts? >How-To-Repeat: 1) Install FreeBSD (I choose to install 8.2-STABLE) 2) Install an i386 chroot: cd /usr/src && make buildworld installworld distribution TARGET=i386 DESTDIR=/compat/i386 3) Compile the following program once in the 64bit env, and again in the chroot'd 32bit env. ################################ #include <stdarg.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <net/if.h> int main(void) { struct ifconf *ifc; struct ifconf difc; int lastlen, cnt = 0; int ioctlRet = 0; int guessedNumAddresses = 0, numAddresses = 0; int fd; fd = socket(PF_INET, SOCK_DGRAM, 0); ifc=&difc; ifc->ifc_len = 0; ifc->ifc_buf = NULL; if (fd != -1) { do { ifc->ifc_buf = NULL; printf("%i ::",cnt); cnt++; lastlen = ifc->ifc_len; if (guessedNumAddresses == 0) guessedNumAddresses = 4; else guessedNumAddresses *= 2; ifc->ifc_len = sizeof(struct ifreq) * guessedNumAddresses; ifc->ifc_buf = malloc(ifc->ifc_len); ioctlRet = ioctl(fd, SIOCGIFCONF, ifc); printf(" %i %i %i %s\n",ioctlRet,ifc->ifc_len,lastlen,ifc->ifc_buf); } while ((ioctlRet == 0) && (ifc->ifc_len != lastlen)); } } ################################ >Fix: Unknown >Release-Note: >Audit-Trail: >Unformatted:home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106280320.p5S3KQqu069145>
