plan9fox/sys
cinap_lenrek 656dd953a8 segment: fix read/write g->dlen race, avoid copying kernel memory, qlock
code like "return g->dlen;" is wrong as we do not hold the
qlock of the global segment. another process could come in
and override g->dlen making us return the wrong byte count.

avoid copying when we already got a kernel address (kernel memory
is the same on processes) which is the case with bread()/bwrite().
this is the same optimization that devsd does.

also avoid allocating/freeing and copying while holding the qlock.
when we copy to/from user memory, we might fault preventing
others from accessing the segment while fault handling is in
progress.
2015-04-13 23:18:56 +02:00
..
doc /sys/doc: permissions for cleanps, mkdirlist, mkfilelist 2012-10-20 19:09:54 +02:00
games/lib fortunes: TED, day 1: I want to believe -- WIRED magazine 2015-03-26 20:43:41 -04:00
include libmach: use #pragma pack to force 4 byte alignment of bootexec.h structures for amd64 2015-03-18 19:31:51 +01:00
lib hg: install hgweb templates 2015-03-13 18:30:59 +01:00
man segment(3): document fixed segment creation 2015-04-12 16:38:39 +02:00
src segment: fix read/write g->dlen race, avoid copying kernel memory, qlock 2015-04-13 23:18:56 +02:00