From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 4 18:10:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B45519AF for ; Fri, 4 Jan 2013 18:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB449A for ; Fri, 4 Jan 2013 18:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id r04IA1S9040650 for ; Fri, 4 Jan 2013 18:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id r04IA1SH040649; Fri, 4 Jan 2013 18:10:01 GMT (envelope-from gnats) Date: Fri, 4 Jan 2013 18:10:01 GMT Message-Id: <201301041810.r04IA1SH040649@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Eitan Adler Subject: Re: kern/174933 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Eitan Adler List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2013 18:10:01 -0000 The following reply was made to PR kern/174933; it has been noted by GNATS. From: Eitan Adler To: bug-followup Cc: Subject: Re: kern/174933 Date: Fri, 4 Jan 2013 13:04:31 -0500 ---------- Forwarded message ---------- From: Martin Laabs Date: 4 January 2013 12:40 Subject: Bug analyzed - how to fix it? To: freebsd-emulation@freebsd.org Hi, I'm (hopefully) done with the bug analyses of "http://www.freebsd.org/cgi/query-pr.cgi?pr=174933". The bug in one sentences: if_nameindex (resided in the libc) fails if called out of a linux binary. The cause is that the if_nameindex calls a function named __opensock that return a socket. This socket is used to call an ioctl(SIOCGIFCONF ...). This ioctl call is actually implemented in the linuxulator. Unfortunately the __opensock function tries to create the following socket: socket(PF_NETLINK, SOCK_RAW, 0) in decimal: socket(16,3,0) This type of socket type however is not supported by the linuxulator and IMHO in freebsd at all. However - maybe it just has another name in FreeBSD. So - for me there seem to be two solutions: 1. Write a dirty patch that returns a PF_INET instead of the PF_NETLINK socket if called with the arguments above. This should be OK since I assume that SIOCGIFCONF ioctl works also fine with PF_INET sockets. (I'll test this to verify whether this is true) This however would be somewhat dirty since PF_NETLINK sockets are not really supported and if another application tries to open a real PF_NETLINK socket it will get a false positive result. 2. Patch the glibc to not create a PF_NETLINK socket in __opensock but create a PF_INET socket instead. The problem is that I do not know about the side effects since the __opensock function is used elsewhere in the libc also. The second drawback is that this would lead to a customized libc for the linuxulator. As far as I know the current libc(s) are just bare copies out of linux systems. So this solution would also increase maintenance effort. Do you have an other idea how to fix the problem? Thank you, Martin _______________________________________________ freebsd-emulation@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org" -- Eitan Adler