kern/174933: if_nameindex fail in linuxulator enviroment
Martin Laabs
info at martinlaabs.de
Thu Jan 3 11:00:01 UTC 2013
>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 at 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 <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
#include <string.h>
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:
More information about the freebsd-bugs
mailing list