Date: Fri, 03 Jul 2020 22:33:56 +0000 From: bugzilla-noreply@freebsd.org To: emulation@FreeBSD.org Subject: [Bug 240767] linprocfs(4) - /proc/fd is weird Message-ID: <bug-240767-4077-USUMqJug0X@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-240767-4077@https.bugs.freebsd.org/bugzilla/> References: <bug-240767-4077@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240767 --- Comment #2 from Edward Tomasz Napierala <trasz@FreeBSD.org> --- Okay, so after another afternoon spent debugging this stuff, here's how it looks: First, glibc (namely gettyname()) requires contents of /proc/self/fd/ to be symlinks. Turns out it's trivial to make it work, and it's even documented: just mount fdescfs with 'linrdlnk' option. I'll make /etc/rc.d/linux defau= lt to it soon. Problem is: it doesn't work when you chroot into your Linux root (eg /compat/linux). For some reason glibc tries to be very, _very_ careful with the name it got from /proc/self/fd/0; it calls stat(2) on fd 0, and then on= the symlink target, and compares st_dev. When chrooted to /compat/linux, your stdin is on /dev, while /proc/self/fd/0 (really /compat/linux/proc/self/fd/= 0) points to /dev/fd/0 (really /compat/linux/dev/fd/0); since /dev and /compat/linux/dev have different fsids, and thus stat(2) returns different st_dev, the glibc check fails. Workaround: run sshd inside your linux chroot and ssh into localhost. Meh. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240767-4077-USUMqJug0X>