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>

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

[-- Attachment #1 --]
* John Nielsen <lists@jnielsen.net> wrote:
> Pretty or not the hack does the job. Thanks again!
> 
> For the record the sshd that ships with Fedora 12 also had the same issue, 
> and the hack fixes it as well (not surprisingly). (I'll stick with CentOS 
> though, since blatantly lying about the kernel version doesn't give me warm 
> 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
===================================================================
--- sys/compat/linprocfs/linprocfs.c	(revision 204763)
+++ sys/compat/linprocfs/linprocfs.c	(working copy)
@@ -1245,6 +1245,20 @@
 #endif
 
 /*
+ * Filler function for proc/pid/fd
+ */
+static int
+linprocfs_dofdescfs(PFS_FILL_ARGS)
+{
+
+	if (p == 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);
 
 	/* /proc/scsi/... */
 	dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);
%%%

This is a bit more complete. What it does, is that it creates a symlink
from /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?

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

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

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

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