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=T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2564 invoked from network); 28 May 2022 22:08:41 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 28 May 2022 22:08:41 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 9front; Sat May 28 18:07:22 -0400 2022 Received: from stockyard (cpe-68-174-86-38.nyc.res.rr.com [68.174.86.38]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 1fc3bb49 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sat, 28 May 2022 15:07:13 -0700 (PDT) Message-ID: <9E383ECACA7EE889BC909B855AF9D60B@eigenstate.org> To: 9front@9front.org Date: Sat, 28 May 2022 18:07:11 -0400 From: ori@eigenstate.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: open-source full-stack table-based persistence injection frontend Subject: Re: [9front] git: use new /dev/drivers for privdrop Reply-To: 9front@9front.org Precedence: bulk Quoth covertusername967@gmail.com: > Quoth ori@eigenstate.org: > > This needs to be held off for a bit, but it seems > > like a good idea: we shouldn't need any devices at > > all for this code, so let's not keep them. > > > > ddiff 01a6de812c2fd38c9a28036300e3c2c7dc8441f5 uncommitted > > --- a/sys/src/cmd/git/serve.c > > +++ b/sys/src/cmd/git/serve.c > > @@ -5,7 +5,7 @@ > > > > #include "git.h" > > > > -char *pathpfx = nil; > > +char *pathpfx = "/"; > > int allowwrite; > > > > int > > @@ -469,6 +469,22 @@ > > return 0; > > } > > > > +void > > +privdrop(void) > > +{ > > + int fd; > > + > > + if(rfork(RFNAMEG) == -1) > > + sysfatal("rfork: %r"); > > + if((fd = open("#c/drivers", OWRITE)) == -1) > > + sysfatal("open drivers: %r"); > > + if(bind(pathpfx, "/", MREPL) == -1) > > + sysfatal("bind: %r"); > > + if(write(fd, "chdev &", strlen("chdev &")) == -1) > > + sysfatal("drop permissions: %r"); > > + close(fd); > > +} > > + > > char* > > parsecmd(char *buf, char *cmd, int ncmd) > > { > > @@ -518,15 +534,8 @@ > > }ARGEND; > > > > gitinit(); > > + privdrop(); > > interactive = 0; > > - if(rfork(RFNAMEG) == -1) > > - sysfatal("rfork: %r"); > > - if(pathpfx != nil){ > > - if(bind(pathpfx, "/", MREPL) == -1) > > - sysfatal("bind: %r"); > > - } > > - if(rfork(RFNOMNT) == -1) > > - sysfatal("rfork: %r"); > > > > initconn(&c, 0, 1); > > if(readpkt(&c, buf, sizeof(buf)) == -1) > > > > Correct me if i'm wrong, but if i remember correctly, wasn't git9 intended to be compatible with 9legacy as well as 9front? Won't this break compatibility? > I guess I can skip this patch when I pull things into the mirror, though -- I'm also not sure anyone is using it on 9legacy.