plan9fox/sys/src/9/port
cinap_lenrek 4b4070a8b9 ratrace: fix race conditions and range check
the syscallno check in syscallfmt() was wrong. the unsigned
syscall number was cast to an signed integer. so negative
values would pass the check provoking bad memory access from
kernel. the check also has an off by one. one has to check
syscallno >= nsyscalls instead of syscallno > nsyscalls.

access to the p->syscalltrace string was not protected
from modification in devproc. you could awake the process
and cause it to free the string giving an opportunity for
the kernel to access bad memory. or someone could kill the
process (pexit would just free it).

now the string is protected by the usual p->debug qlock. we
also keep the string arround until it is overwritten again
or the process exists. this has the nice side effect that
one can inspect it after the process crashed.

another problem was that our validaddr() would error() instead
of pexiting the current process. the code was changed to only
access up->s.args after it was validated and copied instead of
accessing the user stack directly. this also prevents a sneaky
multithreaded process from chaning the arguments under us.

in case our validaddr() errors, we cannot assume valid user
stack after the waserror() if block. use up->s.arg[0] for the
noted() call to avoid bad access.
2012-11-23 20:27:09 +01:00
..
alarm.c
alloc.c make smalloc() uninterruptable as most callers cant handle it anyway 2012-02-06 05:28:57 +01:00
allocb.c
aoe.h merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
audioif.h audio: add delay control 2011-07-03 03:42:37 +02:00
auth.c devproc buffer overflow, strncpy 2012-10-01 02:52:05 +02:00
bootfs.proto added hjfs 2012-08-07 17:57:04 +02:00
cache.c kernel: mnt cache rework 2012-10-17 15:48:30 +02:00
chan.c limit clunk queue length for cclose() 2012-11-07 22:04:29 +01:00
cis.c
debugalloc.c panic: trailing newlines 2012-03-28 18:13:45 +02:00
dev.c panic: trailing newlines 2012-03-28 18:13:45 +02:00
devaoe.c kernel: try to catch some (rare) mistakes 2012-10-11 17:29:16 +02:00
devaudio.c kernel: fix more malloc/smalloc errors 2011-12-12 19:17:58 +01:00
devbridge.c devproc buffer overflow, strncpy 2012-10-01 02:52:05 +02:00
devcap.c
devcons.c panic(): dont print message twice. for terminals, dont auto reboot. 2011-12-13 16:07:52 +01:00
devdraw.c devdraw: fix stats for #i/winname (thanks jas) 2012-10-27 22:27:19 +02:00
devdup.c
devenv.c add Etoolong error string, cleanup genbuf truncation fix 2012-02-08 02:32:03 +01:00
devflash.c add Etoolong error string, cleanup genbuf truncation fix 2012-02-08 02:32:03 +01:00
devfs.c devfs: dont raise "no more trees" if malloc fails 2011-12-13 16:12:40 +01:00
devkprof.c
devloopback.c
devmnt.c devmnt: more carefull wakeup in mountmux 2012-08-24 13:00:14 +02:00
devmouse.c devmouse: add twitch mousectl command 2012-02-13 07:06:08 +01:00
devpipe.c
devpnp.c kernel: fix more malloc/smalloc errors 2011-12-12 19:17:58 +01:00
devproc.c ratrace: fix race conditions and range check 2012-11-23 20:27:09 +01:00
devroot.c kernel: try to catch some (rare) mistakes 2012-10-11 17:29:16 +02:00
devsd.c add Echange[] error string 2012-08-07 07:15:41 +02:00
devsdp.c devproc buffer overflow, strncpy 2012-10-01 02:52:05 +02:00
devsegment.c devproc buffer overflow, strncpy 2012-10-01 02:52:05 +02:00
devshr.c devshr: honor noattach 2012-09-06 01:05:37 +02:00
devsrv.c add Etoolong error string, cleanup genbuf truncation fix 2012-02-08 02:32:03 +01:00
devssl.c devssl: tiny fixes (from plan 9) 2011-12-12 14:59:14 +01:00
devtls.c
devuart.c Qcoalesce patch to satisfy full read length 2012-09-14 03:35:15 +02:00
devwd.c kernel: fix more malloc/smalloc errors 2011-12-12 19:17:58 +01:00
ecc.c
edf.c
edf.h
error.h add Echange[] error string 2012-08-07 07:15:41 +02:00
fault.c kernel: cachedel() lock order, lookpage, cleanup 2012-10-16 14:12:21 +02:00
flashif.h
initcode.c
led.c merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
led.h merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
lib.h merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
log.c kernel: fix more malloc/smalloc errors 2011-12-12 19:17:58 +01:00
master.local
mkbootrules
mkdevc
mkdevlist
mkerrstr
mkextract
mkfile
mkfilelist
mkroot
mkrootall
mkrootc
mksystab
mul64fract.c
nandecc.h
netif.c kernel: try to catch some (rare) mistakes 2012-10-11 17:29:16 +02:00
netif.h
page.c kernel: duppage cleanup 2012-10-16 16:10:26 +02:00
parse.c
pgrp.c
portclock.c kernel: fix inproper use of malloc/smalloc 2011-12-12 16:55:26 +01:00
portdat.h swap: track swap pages with > 255 references, setswapchan() swapimage.c 2012-10-15 14:04:30 +02:00
portfns.h ratrace: fix race conditions and range check 2012-11-23 20:27:09 +01:00
portmkfile
print.c
proc.c ratrace: fix race conditions and range check 2012-11-23 20:27:09 +01:00
qio.c kernel: try to catch some (rare) mistakes 2012-10-11 17:29:16 +02:00
qlock.c panic: trailing newlines 2012-03-28 18:13:45 +02:00
random.c kernel: move duplicated random.c to port 2012-05-03 08:49:25 +02:00
rdb.c
rebootcmd.c kernel: fix more malloc/smalloc errors 2011-12-12 19:17:58 +01:00
sd.h merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
sdaoe.c merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
sdloop.c merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
sdscsi.c fix cdrom media change 2011-12-06 14:49:40 +01:00
segment.c kernel: attachimage / exec error handling 2012-10-14 19:48:46 +02:00
semaphore.p
swap.c swap: track swap pages with > 255 references, setswapchan() swapimage.c 2012-10-15 14:04:30 +02:00
syscallfmt.c ratrace: fix race conditions and range check 2012-11-23 20:27:09 +01:00
sysfile.c async clunk for cached mounts, fix closeproc explosion 2012-04-27 17:51:20 +02:00
sysproc.c ratrace: fix race conditions and range check 2012-11-23 20:27:09 +01:00
systab.h add tsemacquire syscall for go 2012-07-29 20:26:49 +02:00
taslock.c
thwack.c
thwack.h
tod.c
unthwack.c
usb.h usb: added buffer delay control 2011-08-01 19:02:50 +02:00
usbehci.c usb: fix potential isoread overruns, error instead of panic on isoread in ohci 2012-09-03 04:23:02 +02:00
xalloc.c