9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Roman V. Shaposhnik" <rvs@sun.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] directly opening Plan9 devices
Date: Sat,  3 Jan 2009 14:40:24 -0800	[thread overview]
Message-ID: <1231022424.11463.231.camel@goose.sun.com> (raw)
In-Reply-To: <5815b4f0a81ae76e01b8987ae27bdb31@quanstro.net>

On Sat, 2009-01-03 at 17:03 -0500, erik quanstrom wrote:
> > Did you see the example I provided in the original
> > email? "rfork m" is *exactly* RFNOMNT. And it doesn't
> > seem to work for one simple reason: RFNOMNT doesn't
> > restrict bind(2).
>
> these are exceptions.  from port/chan.c:
>
> 	case '#':
> 		nomount = 1;
> 		up->genbuf[0] = '\0';
> 		n = 0;
> 		while(*name != '\0' && (*name != '/' || n < 2)){
> 			if(n >= sizeof(up->genbuf)-1)
> 				error(Efilename);
> 			up->genbuf[n++] = *name++;
> 		}
> 		up->genbuf[n] = '\0';
> 		/*
> 		 *  noattach is sandboxing.
> 		 *
> 		 *  the OK exceptions are:
> 		 *	|  it only gives access to pipes you create
> 		 *	d  this process's file descriptors
> 		 *	e  this process's environment
> 		 *  the iffy exceptions are:
> 		 *	c  time and pid, but also cons and consctl
> 		 *	p  control of your own processes (and unfortunately
> 		 *	   any others left unprotected)
> 		 */
> 		n = chartorune(&r, up->genbuf+1)+1;
> 		/* actually / is caught by parsing earlier */
> >>>>		if(utfrune("M", r))
> >>>>			error(Enoattach);
> >>>>		if(up->pgrp->noattach && utfrune("|decp", r)==nil)
> 			error(Enoattach);
> 		t = devno(r, 1);
> 		if(t == -1)
> 			error(Ebadsharp);
> 		c = devtab[t]->attach(up->genbuf+n);
> 		break;
>
> the first two indicated lines are redundant.
> i'm not so sure about any of the exceptions.

Two comments:
   0. First of all, thanks for the code snippet. I'm so used to Plan9
      having as little exceptions as possible and being very well
      documents that I sometimes forget to look for the source.
   1. This better be documented in the man pages, if you ask me.

And finally, I'd say having these exceptions is a mistake. Unless,
there's a really good reason, they break the paradigm of RFNOMNT
quite needlessly without even a hint of a benefit.

Anybody disagrees?

Thanks,
Roman.




  reply	other threads:[~2009-01-03 22:40 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-03 21:44 Roman V. Shaposhnik
2009-01-03 21:46 ` erik quanstrom
2009-01-03 21:56   ` Roman V. Shaposhnik
2009-01-03 22:03     ` erik quanstrom
2009-01-03 22:40       ` Roman V. Shaposhnik [this message]
2009-01-03 22:46         ` Francisco J Ballesteros
2009-01-03 22:56           ` erik quanstrom
2009-01-04  5:00             ` Roman V. Shaposhnik
2009-01-04  5:40               ` erik quanstrom
2009-01-04  4:58           ` Roman V. Shaposhnik
2009-01-03 22:57         ` erik quanstrom
2009-01-03 23:15           ` Russ Cox
2009-01-03 23:17             ` erik quanstrom
2009-01-04  5:07             ` Roman V. Shaposhnik
2009-01-04  5:05           ` Roman V. Shaposhnik
2009-01-03 22:21     ` Francisco J Ballesteros
2009-01-03 22:40       ` erik quanstrom
2009-01-04  5:12       ` Roman V. Shaposhnik
2009-01-04  5:27         ` erik quanstrom
2009-01-04  5:39           ` lucio
2009-01-04  5:42             ` erik quanstrom
2009-01-05  0:52           ` Roman V. Shaposhnik
2009-01-05  6:21             ` Roman Zhukov
2009-01-05 11:00             ` Charles Forsyth
2009-01-06  5:02               ` Roman Shaposhnik
2009-01-06 14:17                 ` erik quanstrom
2009-01-07 16:55                   ` ron minnich
2009-01-07 17:16                     ` erik quanstrom
2009-01-08  5:13                       ` ron minnich
2009-01-08 13:37                         ` erik quanstrom
2009-01-08 14:03                           ` Charles Forsyth
2009-01-08 15:36                           ` ron minnich
2009-01-08 15:44                             ` erik quanstrom
2009-01-08 17:34                             ` Roman V. Shaposhnik
2009-01-08 17:35                             ` Charles Forsyth
2009-01-08  7:45                     ` Dave Eckhardt
2009-01-08 17:43                     ` Roman V. Shaposhnik
2009-01-08 23:30                   ` Roman V. Shaposhnik
2009-01-04  7:01         ` Russ Cox
2009-01-04 11:41           ` lucio
2009-01-04 13:01             ` Uriel
2009-01-04 13:16               ` lucio
2009-01-05  0:41           ` Roman V. Shaposhnik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1231022424.11463.231.camel@goose.sun.com \
    --to=rvs@sun.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).