summaryrefslogtreecommitdiff
path: root/sys/src/lib9p/srv.c
AgeCommit message (Collapse)Author
2020-04-27lib9p: reject reads on closed fids and writes on directoriescinap_lenrek
mischief provided the following test that shows the issue: ramfs -S crash aux/9pcon /srv/crash <<EOF Tversion 8192 9P2000 Tattach 0 -1 $user '' Tcreate 0 dir 020000000777 0 Tattach 5 -1 $user '' Twalk 5 6 dir Tread 6 0 512 EOF the problem is that lib9p wrongly allowed reads on closed fids, due to the permission check only considering the lower 2 bits. a closed fid has fid->omode == -1 and it would pass on read for: (-1 & 3) == 3 == OEXEC the following change explicitely checks for for the closed case and also rejects writes on directories (they are rejected on open/create, but a broken 9p client could still issue the request).
2020-03-08lib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove ↵cinap_lenrek
postfd() and sharefd() functions with the latest changes to shr(3), we can use ORCLOSE on the control file to get the mount in the share automatically removed when the server exits or something goes wrong during postsharesrv(). do not expose postfd() and sharefd() functions. they where undocumented and leak the control file descriptors.
2020-03-07lib9p: fix typocinap_lenrek
2020-03-07lib9p: zero out per connection state in Srv template for listensrv()cinap_lenrek
in case listensrv() is called with a previously active Srv, we have to make sure that per connection state is zeroed out (locks and reference conuts). also, dont assume anything about the Ref structure. there might be implementations that have a spinlock in them.
2019-03-01lib9p: fix zero msize abort() due to unknown version (thanks kivik)cinap_lenrek
kivik wrote: I've found a nasty bug in lib9p handling of Tversion messages, where an invalid version string in the request leads to servers abort()ing the spaceship. To reproduce: ; ramfs -S ram ; aux/9pcon /srv/ram Tversion ~0 DIE The issue lies in sversion() where in case an invalid version string is received we respond right away with ofcall.version="unknown"; however, we fail to set the ofcall.msize, which at this point is cleared to 0. This causes the convS2M call in respond() to fail and abort being called.
2017-04-30lib9p: allow rewinding in 9pfile directoriescinap_lenrek
2016-10-23lib9p: limit the number of srv processes kept arround 8cinap_lenrek
2016-07-24make error handling in 9p service loops consistentcinap_lenrek
when we get eof, stop the loop immidiately and do not rely on the read to eventually return an error. when convM2S() fails to decode the message, error out and stop the loop. there is no point in continuing.
2015-10-15lib9p: do not override Srv.end in listensrv(), simplify srvclose() and ↵cinap_lenrek
recounting listensrv() used to override Srv.end() with its own handler to free the malloc'd Srv structure and close the fd. this makes it impossible to register your own cleanup handler. instead, we introduce the private Srv.free() handler that is used by listensrv to register its cleanup code. Srv.free() is called once all the srv procs have been exited and all requests on that srv have been responded to while Srv.end() is called once all the procs exited the srv loop regardless of the requests still being in flight.
2015-07-28lib9p: return "write prohibited" error as documented in 9p(2) when ↵cinap_lenrek
srv->write is nil (thanks silasm)
2015-06-13lib9p: fix lib9p wstat qid.type/mode checks (fixes lock(1) for ramfs/hjfs)cinap_lenrek
2014-09-19lib9p: fix nil dereference crash in remove for directory permission checkcinap_lenrek
file->parent can be nil when the file has been previously removed. removefile() deals with this, so skip the permission check in that case and let removefile() error out.
2013-10-02lib9p/hjfs: use x != ~0 instead (type)~x conditionals to work arround arm ↵cinap_lenrek
compiler issue
2013-06-16make filesystem handling of read9pmsg() consistentcinap_lenrek
2013-01-30lib9p: defer closing down srv until the last request has been responded, ↵cinap_lenrek
Tversion message size in multithreaded programs, we have to wait until all outstanding requests have been responded before closing down the srv. dont make write errors sysfatal(), only print them. in case if listensrv() is used we dont want to exit the process in respond() called by some worker thread. make sure Tversion is only handled when there are no outstanding requests and make sure message size is sane.
2012-03-30lib9p: add Srv.startcinap_lenrek
2011-08-19lib9p: add srvacquire/srvreleasecinap_lenrek
2011-08-16usb ptp camera drivercinap_lenrek
2011-07-30devshr: changed #σc to contain directoriesaiju
nusb: detaching
2011-07-27lib9p: added functions for devshraiju
2011-07-09lib9p: respond with error instead of aborting for unknown 9p messagescinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen