From owner-freebsd-emulation@FreeBSD.ORG Fri Jan 4 17:40:24 2013 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 665713BC for ; Fri, 4 Jan 2013 17:40:24 +0000 (UTC) (envelope-from info@martinlaabs.de) Received: from relay04.alfahosting-server.de (relay04.alfahosting-server.de [109.237.142.240]) by mx1.freebsd.org (Postfix) with ESMTP id 254F3F0B for ; Fri, 4 Jan 2013 17:40:23 +0000 (UTC) Received: by relay04.alfahosting-server.de (Postfix, from userid 1001) id B8EFA32C1B59; Fri, 4 Jan 2013 18:40:22 +0100 (CET) X-Spam-DCC: : X-Spam-Level: X-Spam-Status: No, score=0.0 required=7.0 tests=BAYES_50 autolearn=disabled version=3.2.5 Received: from alfa3018.alfahosting-server.de (alfa3018.alfahosting-server.de [109.237.140.30]) by relay04.alfahosting-server.de (Postfix) with ESMTP id B831832C18FD for ; Fri, 4 Jan 2013 18:40:20 +0100 (CET) Received: from pc.martinlaabs.de (p54B32E3A.dip.t-dialin.net [84.179.46.58]) by alfa3018.alfahosting-server.de (Postfix) with ESMTPSA id 82123515C396 for ; Fri, 4 Jan 2013 18:40:20 +0100 (CET) Message-ID: <50E71402.8010702@martinlaabs.de> Date: Fri, 04 Jan 2013 18:40:18 +0100 From: Martin Laabs User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: freebsd-emulation@freebsd.org Subject: Bug analyzed - how to fix it? X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Status: No X-Virus-Checker-Version: clamassassin 1.2.4 with ClamAV 0.97.3/16353/Fri Jan 4 16:39:23 2013 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2013 17:40:24 -0000 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