From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7947 invoked from network); 26 May 2022 23:40:08 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 26 May 2022 23:40:08 -0000 Received: from pb-smtp20.pobox.com ([173.228.157.52]) by 9front; Thu May 26 19:38:26 -0400 2022 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id CB92B194937 for <9front@9front.org>; Thu, 26 May 2022 19:38:21 -0400 (EDT) (envelope-from unobe@cpan.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id :to:subject:date:from:in-reply-to:mime-version:content-type :content-transfer-encoding; s=sasl; bh=xRO9no0/JvGrVjRPC48KRoKFZ 6EEuwytm4uQv1zQQQs=; b=g7Fq64zTJ6mSI/gNc5JYfcHRefOSnyiSEF+CGVDwa 51MkDJs1SXF+1wXfucMrt1LI7Sqagosq1yClaLa+TIuh/aIFknOWmP0lcWxD9OPA vkyM8lRT6MYj9mOx4EVnnAzP8K+iw7ZD+sMXKABQ/bJM3YifpKoF0XkWK8F9jokf LI= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id C39F9194935 for <9front@9front.org>; Thu, 26 May 2022 19:38:21 -0400 (EDT) (envelope-from unobe@cpan.org) Received: from strider.localdomain (unknown [72.105.225.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 0B1CC194904 for <9front@9front.org>; Thu, 26 May 2022 19:38:17 -0400 (EDT) (envelope-from unobe@cpan.org) Message-ID: To: 9front@9front.org Date: Thu, 26 May 2022 16:36:33 -0700 From: unobe@cpan.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Pobox-Relay-ID: EB93E9F6-DD4C-11EC-B234-C85A9F429DF0-09620299!pb-smtp20.pobox.com List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: extensible database-oriented SQL base firewall package-aware manager Subject: Re: [9front] [PATCH] Unmount to remove sharp devices. Reply-To: 9front@9front.org Precedence: bulk Great work on this moody. I have some (hopefully helpful) questions below. Quoth Jacob Moody : > Another iteration. > To state all of what this does: > > A process can remove access to a driver through writing > > chdev [ 0! ] devmask > > to /dev/drivers. This is tied to the processes namegroup, > and is inherited on both RFCNAMEG and RFNAMEG. In order to provide > all the knobs RFNOMNT does, blocking 'M' is interpreted to block all mounting. > > Support for this new operation has been added to namespace files, > along with a matching chdev(1). /lib/namespace.ftp has been updated > to use chdev. > ... > --- /tmp/diff100000711164 > +++ b/rc/bin/chdev > @@ -1,0 +1,3 @@ > +#!/bin/rc > + > +echo chdev $* >> '#c/drivers' > ... > --- /tmp/diff100000711170 > +++ b/sys/man/1/chdev > @@ -1,0 +1,93 @@ > +.TH CHDEV 1 > +.SH NAME > +chdev \- change kernel driver access > +.SH SYNOPSIS > +.B chdev > +[ 0! ] \f2devmask\fP... > --- a/sys/src/9/port/dev.c > +++ b/sys/src/9/port/dev.c > @@ -31,6 +31,74 @@ > } > > void > +devmask(Pgrp *pgrp, char *devs) > +{ > + int i, t, w; > + int invert; > + char *p; > + Rune r; > + u64int mask[nelem(pgrp->notallowed)]; > + > + > + invert = 1; > + switch(*devs){ > + case '!': > + memset(mask, 0, sizeof mask); > + devs++; > + invert--; > + break; > + case '0': > + devs = ""; > + default: > + memset(mask, 0xFF, sizeof mask); > + break; > + } > + > + w = sizeof mask[0] * 8; > + for(p = devs; *p != '\0';){ > + p += chartorune(&r, p); > + t = devno(r, 1); > + if(t == -1) > + continue; > + if(invert) > + mask[t/w] &= ~(1< + else > + mask[t/w] |= 1< + } What happens if '!!!' is the prefix? Should the '!' set invert = 0 explicitly instead of invert--? Does '!0' allow access to all drivers?