Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Mar 2010 08:31:17 +0100
From:      Ed Schouten <ed@80386.nl>
To:        John Nielsen <lists@jnielsen.net>
Cc:        Alexander Leidinger <Alexander@leidinger.net>, freebsd-emulation@freebsd.org
Subject:   Re: linux-only jail possible?
Message-ID:  <20100306073117.GE8200@hoeg.nl>
In-Reply-To: <201003060113.32628.lists@jnielsen.net>
References:  <201003021325.27197.lists@jnielsen.net> <20100305092611.0000772c@unknown> <20100305091446.GZ8200@hoeg.nl> <201003060113.32628.lists@jnielsen.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--w803fMwrd3YJFiOr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* John Nielsen <lists@jnielsen.net> 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 <ed@80386.nl>
 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100306073117.GE8200>