From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 1 Oct 2009 22:03:21 -0500 Message-ID: From: Jason Catena To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [9fans] remedial sources auth, connect, and mount in plan9port Topicbox-Message-UUID: 7b9328cc-ead5-11e9-9d60-3106f5b1d025 On Thu, Oct 1, 2009 at 11:22, erik quanstrom wrote: >> Every time I do so, either with touch or chmod for example, I get >> errors like this: >> >> Oct 1 08:52:39.288 read bad packet from 5 > > add some debugging to 9pserve.c around 'read bad packet'. > i'm gonna guess (since i don't have time to get p9p auth > working) that this test has failed src/lib9/convM2S.c:216,217 > > - erik I instrumented the code as you suggested. /usr/local/plan9/src/cmd/9pserve.c: Msg* mread9p(Ioproc *io, int fd, int dotu) { int n, nn; uchar *pkt; Msg *m; if((pkt = read9ppkt(io, fd)) == nil) return nil; m = msgnew(0); m->tpkt = pkt; n = GBIT32(pkt); nn = convM2Su(pkt, n, &m->tx, dotu); if(nn != n){ fprint(2, "%T read bad packet from %d\n", fd); fprint(2, "n=%d nn=%d\n", n, nn); return nil; } return m; } /usr/local/plan9/src/lib9/convM2S.c: uint convM2Su(uchar *ap, uint nap, Fcall *f, int dotu) { /* snip */ case Twstat: if(p+BIT32SZ+BIT16SZ > ep) return 0; f->fid = GBIT32(p); p += BIT32SZ; f->nstat = GBIT16(p); p += BIT16SZ; if(p+f->nstat > ep) { fprint(2, "erik is the man! p(%x)+f->nstat(%x) > ep(%x)", p, f->nstat, ep); return 0; } f->stat = p; p += f->nstat; break; /* snip */ } My test case tries to copy a file over top of one that already exists. In this case, the bug decided to flit right by the check at convM2S.c:216,217. jdc@jdc-desktop:~$ 9 factotum jdc@jdc-desktop:~$ srv -a sources.cs.bell-labs.com !adding key: role=client proto=p9sk1 dom=outside.plan9.bell-labs.com user[jdc]: catenate password: ! jdc@jdc-desktop:~$ sudo 9mount -i 'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources [sudo] password for jdc: 9mount: mount: Not a directory jdc@jdc-desktop:~$ ls /n/sources /n/sources jdc@jdc-desktop:~$ sudo 9umount /n/sources jdc@jdc-desktop:~$ sudo 9mount -i 'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources jdc@jdc-desktop:~$ ps ax|grep 9ps 10426 pts/3 Sl 0:00 9pserve -u unix!/tmp/ns.jdc.192.168.1.101:0/factotum 10586 pts/3 Sl 0:00 9pserve -u -M 8192 -A 0 unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com 10603 pts/3 R+ 0:00 grep 9ps jdc@jdc-desktop:~$ cd /n/sources/contrib/catenate jdc@jdc-desktop:/n/sources/contrib/catenate$ cd times jdc@jdc-desktop:/n/sources/contrib/catenate/times$ ls latin1.7a.font jdc@jdc-desktop:/n/sources/contrib/catenate/times$ ls ~/contrib acme guide latin1.7a.font jdc@jdc-desktop:/n/sources/contrib/catenate/times$ sudo cp /home/jdc/contrib/latin1.7a.font . Oct 1 21:52:45.219 read bad packet from 6 n=62 nn=0 cp: cannot create regular file `./latin1.7a.font': Connection reset by peer Jason Catena