Date: Fri, 30 Dec 2005 12:42:03 +0200 (EET) From: Andriy Gapon <avg@icyb.net.ua> To: Alexander Leidinger <netchild@FreeBSD.org> Cc: freebsd-emulation@FreeBSD.org Subject: Re: kern/72920: [linux]: path "prefixing" is not done on unix domain socket addresses Message-ID: <20051230123308.Y20613@oddity.topspin.kiev.ua> In-Reply-To: <200512291610.jBTGAfgf010522@freefall.freebsd.org> References: <200512291610.jBTGAfgf010522@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Dec 2005, Alexander Leidinger wrote: > Does this problem still persists on a recent FreeBSD? I can confirm that the problem still exists on FreeBSD 5.4 and looking at linux_socket.c differences between 5.4 and HEAD I am sure that the problem exists in all releases/branches: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/compat/linux/linux_socket.c.diff?r1=1.51.2.3&r2=1.62&f=h I am attaching a simple test program, so that anyone interested could easily verify the issue. Prerequisites for the test are: /compat/linux/tmp must exist /tmp/foo must not exist /compat/linux/tmp/foo must not exist Usage of ktrace is also advised for additional insights. /************ lin_un_sock.c *********/ #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> #include <stdio.h> #include <errno.h> int main() { struct sockaddr_un addr; int s; int err; /*this will create /compat/linux/tmp/foo/ directory*/ err = mkdir("/tmp/foo", 0777); if(err < 0) { perror("mkdir"); return 1; } s = socket(PF_LOCAL, SOCK_STREAM, 0); if(s < 0) { perror("socket"); return 1; } strcpy(addr.sun_path, "/tmp/foo/bar"); addr.sun_family = AF_LOCAL; /*this will try to bind socket in /tmp/foo/ directory *which does not exist */ err = bind(s, (struct sockaddr *) &addr, SUN_LEN(&addr)); if(err < 0) { perror("bind"); return 1; } return 0; } /******************************/ -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051230123308.Y20613>
