plan9fox/sys
cinap_lenrek 39c3fd117a lib9p: reject reads on closed fids and writes on directories
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-04-27 19:55:42 +02:00
..
doc
games/lib fortunes: As much as I'd love to I feel I have to let it go -- rminnich 2020-04-18 21:37:53 -04:00
include add missing header change (thanks qwx) 2020-04-26 09:03:42 -07:00
lib update colemak kbmap, simpler version with scroll working (thanks jeremy) 2020-03-21 01:50:11 +01:00
man /sys/man/1/mothra: add description of Plumb menu item. 2020-04-21 21:14:26 -04:00
src lib9p: reject reads on closed fids and writes on directories 2020-04-27 19:55:42 +02:00