From owner-freebsd-emulation@FreeBSD.ORG Sat Mar 6 07:31:19 2010 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31295106564A for ; Sat, 6 Mar 2010 07:31:19 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id C64B88FC14 for ; Sat, 6 Mar 2010 07:31:18 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id BA09E1CF40; Sat, 6 Mar 2010 08:31:17 +0100 (CET) Date: Sat, 6 Mar 2010 08:31:17 +0100 From: Ed Schouten To: John Nielsen Message-ID: <20100306073117.GE8200@hoeg.nl> References: <201003021325.27197.lists@jnielsen.net> <20100305092611.0000772c@unknown> <20100305091446.GZ8200@hoeg.nl> <201003060113.32628.lists@jnielsen.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="w803fMwrd3YJFiOr" Content-Disposition: inline In-Reply-To: <201003060113.32628.lists@jnielsen.net> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Alexander Leidinger , freebsd-emulation@freebsd.org Subject: Re: linux-only jail possible? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Mar 2010 07:31:19 -0000 --w803fMwrd3YJFiOr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * John Nielsen wrote: > Truss from the host side seems okay except that -f doesn't work as expect= ed.=20 > I can attach manually to the child processes just before submitting an SS= H=20 > password though so hopefully that's enough. If you want me to do any of t= his=20 > again with different truss flags or other information just let me know. Unfortunately it doesn't contain any open() calls on /dev/ptmx, but I found a way to `fix' it: %%% --- sys/compat/linux/linux_file.c +++ sys/compat/linux/linux_file.c @@ -883,6 +883,8 @@ error =3D kern_readlink(td, name, UIO_SYSSPACE, args->buf, UIO_USERSPACE, args->count); LFREEPATH(name); + if (error =3D=3D ENOENT) + error =3D EINVAL; return (error); } =20 %%% It seems a readlink() call on /proc/self/fd/%d fails inside glibc's ttyname() and the only way to fall back to the looping on /dev/ is by returning a bogus errno. ssize_t len =3D __readlink (procname, ttyname_buf, buflen); if (__builtin_expect (len =3D=3D -1 && errno =3D=3D ENOENT, 0)) { __set_errno (EBADF); return NULL; } I guess we can only fix this bug properly by adding support for /proc/self/fd/%d to linprocfs. --=20 Ed Schouten WWW: http://80386.nl/ --w803fMwrd3YJFiOr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkuSBMUACgkQ52SDGA2eCwXFJACfejsB+BoI55qWuCzjv5l8KlkW ICUAn1gHZSW2JSv9obvbsd35Ls89J+KG =B8Dm -----END PGP SIGNATURE----- --w803fMwrd3YJFiOr--