plan9fox/sys/src/9/port
cinap_lenrek 9aa6573359 kernel: fix tsleep()/twakeup()/tsemacquire() race
tsleep() used to cancel the timer with:

if(up->tt != nil)
	timerdel(up);

which still can result in twakeup() to fire after tsleep()
returns (because we set Timer.tt to nil *before* we call the tfn).
in most cases, this is not an issue as the Rendez*
usually is just &up->sleep, but when it is dynamically allocated
or on the stack like in tsemacquire(), twakeup() will call
wakeup() on a potentially garbage Rendez structure!

to fix the race, we execute the wakup() with the Timer lock
held, and set p->trend to nil only after we called wakeup().

that way, the timerdel(); which unconditionally locks the Timer;
can act as a proper barrier and use up->trend == nil as the
condition if the timer has already fired.
2016-03-26 02:37:42 +01:00
..
alarm.c kernel: simplify procalarm() 2014-01-03 02:16:18 +01:00
alloc.c pc64: fix poolsummary() string format 2014-02-07 23:02:56 +01:00
allocb.c kernel: cleanup exit()/shutdown()/reboot() code 2015-11-30 14:56:00 +01:00
aoe.h aoe: updating aoe driver from erik quanstros 9atom 2013-05-01 18:50:07 +02:00
audioif.h audiohda: first attempt on audio recording support for intel hda audio, distinguish mode in audio code 2013-01-19 01:12:39 +01:00
auth.c kernel: make fversion()/mntversion() types consistent 2016-03-10 03:02:28 +01:00
cache.c kernel: pipelined read ahead for the mount cache 2015-07-26 05:43:26 +02:00
chan.c fix fuckup 2015-08-25 09:35:10 +00:00
cis.c
dev.c
devaoe.c format pointer subtraction results with %zd instead of %ld (for long -> intptr on amd64) 2016-01-07 04:44:13 +01:00
devaudio.c audiohda: allow manual pin routing, more verbose audiostat, initial mute of al widgets 2013-09-29 15:44:26 +02:00
devbridge.c kernel: dont rely on atoi() parsing hex for netif/devbridge 2015-08-03 16:24:14 +02:00
devcap.c
devcons.c devcons: nil vs 0 2016-03-10 03:28:36 +01:00
devdraw.c devdraw: remove unused Edepth[] 2016-02-28 03:06:42 +01:00
devdup.c kernel: avoid inconsistent reads in /proc/#/fd and /proc/#/ns 2014-12-21 04:46:22 +01:00
devenv.c devenv: fix ORCLOSE handling 2015-11-22 02:39:57 +01:00
devflash.c
devfs.c devfs: remove useless ~OTRUNC mask for openmode 2015-06-07 17:41:43 +02:00
devkprof.c kernel: apply uintptr for ulong when a pointer is stored 2014-01-20 00:47:55 +01:00
devloopback.c devloopback: fix potential channel leak on allocation error (from eriks 9atom) 2013-05-01 18:31:13 +02:00
devmnt.c abandon streaming experiment 2016-03-17 17:48:19 +01:00
devmouse.c kernel: move arrow cursor definition to port/devmouse.c 2015-04-07 22:05:48 +02:00
devpipe.c devpipe: fix channel and queue leaks (from erik quanstroms 9atom) 2013-05-01 19:03:56 +02:00
devpnp.c
devproc.c devprov: remove unused extern int unfair 2015-12-16 21:07:24 +01:00
devroot.c provide /n and /mnt early in bootrc to allow consistent use in /lib/namespace 2016-02-14 01:42:32 +01:00
devsd.c devsd: handle SYNCHRONIZE CACHE scsi commands as nops in sdfakescsi() 2015-09-20 14:54:49 +02:00
devsdp.c kernel: kproc error and exit 2013-11-22 22:28:20 +01:00
devsegment.c devsegment: fix parsecmd() memory leak 2015-06-09 03:33:37 +02:00
devshr.c kernel: pgrpcpy(), simplify Mount structure 2015-08-09 21:16:10 +02:00
devsrv.c devsrv, devshr: wstat permissions 2013-06-18 22:09:40 +02:00
devssl.c devssl: use tsmemcmp() to compare mac to close timing side channel 2016-01-13 21:48:09 +01:00
devtls.c devtls: zero secret information before freeing, cleanup 2016-03-23 13:50:58 +01:00
devuart.c devuart: export uartenable() 2013-01-26 17:26:28 +01:00
devusb.c devusb: check for nil hp->dump and hp->seprintep 2015-02-20 18:56:22 +01:00
devwd.c
ecc.c
edf.c
edf.h
error.h kernel: make noswap flag exclude processes from killbig() if not eve, reset noswap flag on exec 2014-08-17 00:50:20 +02:00
fault.c kernel: use nicer check in okaddr(), wet floor signs in fixfault() 2015-11-06 17:27:15 +01:00
flashif.h
initcode.c
led.c
led.h
lib.h make kernel UTFmax and Runemax consistent with libc (21-bit runes) (thanks maurice) 2016-03-10 20:02:36 +01:00
log.c
master.local
mkbootrules
mkdevc kernel: generate dummy bootscreeninit() function when building without vga device 2014-12-13 05:29:51 +01:00
mkdevlist add experimental pc64 kernel 2014-02-01 10:25:10 +01:00
mkerrstr
mkextract
mkfile
mkfilelist
mkroot
mkrootall
mkrootc
mksystab kernel: apply uintptr for ulong when a pointer is stored 2014-01-20 00:47:55 +01:00
mul64fract.c
nandecc.h
netif.c kernel: dont rely on atoi() parsing hex for netif/devbridge 2015-08-03 16:24:14 +02:00
netif.h
page.c kernel: various cleanups of imagereclaim(), pagereclaim(), freepages(), putimage() 2015-07-09 00:01:50 +02:00
parse.c
pgrp.c kernel: pgrpcpy(), simplify Mount structure 2015-08-09 21:16:10 +02:00
portclock.c kernel: change active.machs from bitmap to char array to support up to 64 cpus on pc64 2016-01-05 05:32:40 +01:00
portdat.h abandon streaming experiment 2016-03-17 17:48:19 +01:00
portfns.h kernel: make fversion()/mntversion() types consistent 2016-03-10 03:02:28 +01:00
portmkfile wifi: adjust transmit rate on error (for etheriwl), small mkfile changes 2015-07-10 09:04:05 +02:00
portusbehci.h omap: update omap kernel (from sources) 2013-01-26 17:32:08 +01:00
print.c
proc.c kernel: fix tsleep()/twakeup()/tsemacquire() race 2016-03-26 02:37:42 +01:00
qio.c kernel: remove unused qstate() function 2015-08-04 13:52:29 +02:00
qlock.c kernel: cleanup qlock.c to use nil instead of 0 for pointers 2015-08-02 05:36:35 +02:00
random.c kernel: kproc error and exit 2013-11-22 22:28:20 +01:00
rdb.c
rebootcmd.c kernel: cleanup exit()/shutdown()/reboot() code 2015-11-30 14:56:00 +01:00
sd.h devsd: remove unused timeout field from SDreq 2015-09-20 14:27:41 +02:00
sdaoe.c devaoe: more nil vs. 0 2015-07-23 22:05:46 +02:00
sdloop.c sdloop: hardcode Enotup[] string to avoid devaoe dependency 2014-12-19 02:38:36 +01:00
sdmmc.c sdmmc: handle fakescsi emulation 2015-09-20 14:53:44 +02:00
sdscsi.c devsd: don't raise Enomem error if sdmalloc() fails, instead wait for the memory to become available 2013-05-19 20:59:55 +02:00
segment.c kernel: use uintptr for ibrk() return value (for base >2GB) and clarify segbrk(2) 2015-12-16 21:06:51 +01:00
semaphore.p
swap.c kernel: try freebroken() *before* killbig() (thanks aiju) 2015-08-14 14:45:19 +02:00
swcursor.c dont flush screen when hiding software cursor 2014-11-08 11:48:38 +01:00
syscallfmt.c fix fuckup 2015-08-25 09:35:10 +00:00
sysfile.c kernel: mount flag is int not ulong, reduce size of Mount struct by putting mflag field in what would be wasted as padding 2015-08-09 21:35:50 +02:00
sysproc.c kernel: missing changes for ibrk() prototype 2015-12-21 04:49:29 +01:00
taslock.c zynq: fix barriers 2015-06-18 04:35:46 +02:00
thwack.c
thwack.h
tod.c kernel: remove todfix overflow iprint() spam 2016-01-07 19:37:05 +01:00
ucalloc.c kernel: add portable uncached memory allocator (ucalloc) (from sources) 2013-01-26 17:25:23 +01:00
ucallocb.c kernel: cleanup exit()/shutdown()/reboot() code 2015-11-30 14:56:00 +01:00
unthwack.c
usb.h nusb: resolve endpoint id conflict with different input and output types 2014-04-23 20:03:01 +02:00
usbehci.c usbehci: clean cache unconditionally before handing a buffer to the hardware 2015-09-05 10:14:19 +02:00
xalloc.c kernel: ignore last page at the top of virtual kernel address space for xalloc() 2015-06-19 02:45:58 +02:00