From owner-freebsd-bugs@FreeBSD.ORG Thu Jan 3 11:00:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4E4256AB for ; Thu, 3 Jan 2013 11:00: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 2DFD7F47 for ; Thu, 3 Jan 2013 11:00: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 r03B016G025563 for ; Thu, 3 Jan 2013 11:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id r03B01TD025557; Thu, 3 Jan 2013 11:00:01 GMT (envelope-from gnats) Resent-Date: Thu, 3 Jan 2013 11:00:01 GMT Resent-Message-Id: <201301031100.r03B01TD025557@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Martin Laabs Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0A68E62A for ; Thu, 3 Jan 2013 10:53:49 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id D96ADF07 for ; Thu, 3 Jan 2013 10:53:48 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r03ArlAi024689 for ; Thu, 3 Jan 2013 10:53:47 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r03Arlbd024688; Thu, 3 Jan 2013 10:53:47 GMT (envelope-from nobody) Message-Id: <201301031053.r03Arlbd024688@red.freebsd.org> Date: Thu, 3 Jan 2013 10:53:47 GMT From: Martin Laabs To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/174933: if_nameindex fail in linuxulator enviroment X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2013 11:00:01 -0000 >Number: 174933 >Category: kern >Synopsis: if_nameindex fail in linuxulator enviroment >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 03 11:00:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Martin Laabs >Release: 9.0-RELEASE-p3 >Organization: >Environment: reeBSD pc.martinlaabs.de 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The function call if_nameindex out of the libc failes (return NULL) if it is called out of a linux application. The cause of the failure is an inappropriate call of socket likely called in the __opensock function in the libc. This can be seen out of a ktrace dump: [...] 3319 a.out CALL linux_socketcall(0x1,0xffffc6d4) 3319 a.out RET linux_socketcall -1 errno 97 Address family not supported by protocol family [...] The cause of the wrong arguments for this socket call is not known to me up to now. For all the test I use the f10 linux environment. Tests with different linux-base versions are pending. Maybe someone who installed them can do it. On request I can send the linux binary compiled on debian with a 2.6.18 kernel and libc-2.3.6. >How-To-Repeat: Compile the following program on FreeBSD and Linux: Check the return code - maybe the program will segfault if run as linux binary. #include #include #include #include #include #include int main(int argc, char *argv[]) { struct if_nameindex *ifn; /*Can be omitted - just to test if this makes a difference since the __opensock function remember the last socket options*/ socket(AF_INET, SOCK_DGRAM, 0); ifn=if_nameindex(); if(ifn==0) err("if_nameindex failed\n"); return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: