Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Mar 2010 19:15:12 +0100
From:      Ed Schouten <ed@80386.nl>
To:        John Nielsen <lists@jnielsen.net>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: linux-only jail possible?
Message-ID:  <20100306181512.GK8200@hoeg.nl>
In-Reply-To: <201003061241.59580.lists@jnielsen.net>
References:  <201003021325.27197.lists@jnielsen.net> <20100306073117.GE8200@hoeg.nl> <20100306081238.GF8200@hoeg.nl> <201003061241.59580.lists@jnielsen.net>

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

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

* John Nielsen <lists@jnielsen.net> wrote:
> Pretty or not the hack does the job. Thanks again!
>=20
> For the record the sshd that ships with Fedora 12 also had the same issue=
,=20
> and the hack fixes it as well (not surprisingly). (I'll stick with CentOS=
=20
> though, since blatantly lying about the kernel version doesn't give me wa=
rm=20
> fuzzies.)

That's great to hear.

I am still in doubt what to do. Maybe we could consider committing a
patch like this:

%%%
Index: sys/compat/linprocfs/linprocfs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/compat/linprocfs/linprocfs.c	(revision 204763)
+++ sys/compat/linprocfs/linprocfs.c	(working copy)
@@ -1245,6 +1245,20 @@
 #endif
=20
 /*
+ * Filler function for proc/pid/fd
+ */
+static int
+linprocfs_dofdescfs(PFS_FILL_ARGS)
+{
+
+	if (p =3D=3D curproc)
+		sbuf_printf(sb, "/dev/fd");
+	else
+		sbuf_printf(sb, "unknown");
+	return (0);
+}
+
+/*
  * Constructor
  */
 static int
@@ -1312,6 +1326,8 @@
 	    NULL, NULL, NULL, PFS_RD);
 	pfs_create_file(dir, "status", &linprocfs_doprocstatus,
 	    NULL, NULL, NULL, PFS_RD);
+	pfs_create_link(dir, "fd", &linprocfs_dofdescfs,
+	    NULL, NULL, NULL, 0);
=20
 	/* /proc/scsi/... */
 	dir =3D pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);
%%%

This is a bit more complete. What it does, is that it creates a symlink
=66rom /proc/%d/fd to /dev/fd, only if the calling process matches. Then
when you mount fdescfs on /dev/fd, it also does the right thing, because
it will always readlink() on a character device, which also returns an
error code.

Comments, suggestions anyone?

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--qnRI6fWS/WyDjwPA
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkuSm7AACgkQ52SDGA2eCwVhSwCeNyc4kuxjkf2ZCcH7tzN7xrt6
+8oAn3eNR0WDMLxR3eVXfBvjqSPvW9oG
=+WV+
-----END PGP SIGNATURE-----

--qnRI6fWS/WyDjwPA--



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