plan9fox/sys
cinap_lenrek 2f732e9a85 kernel: attachimage / exec error handling
attachimage()'s approach to handling newseg() error is flawed:

a) the the image is on the hash table, but ref is still 0, and
there is no segment/pages attached to it so nobody is going to
reclaim / putimage() it -> leak

b) calling pexit() would deadlock us because exec has acquired
up->seglock when calling attachimage(), so this would just deadlock.

the fix does the following:

attachimage() will putimage() and nexterror() if newseg() fails
instead of pexit(). this is less surprising.

exec now keeps the condition variable commit which is set once
we are commited / reached the point of no return and check this
variable in the highest waserror() handler and pexit() us there.

this way we have released up all the locks and pexit() will
cleanup.

note: this bug shouldnt us hit in with the current newseg()
implementation as it uses smalloc() which would wait to
satisfy the allocation instead of erroring.
2012-10-14 19:48:46 +02:00
..
doc
games/lib fortunes 2012-10-08 22:14:19 +02:00
include Add alignment hints for e512 ATA drives. 2012-09-09 17:22:12 +12:00
lib /sys/lib/acid/kernel: fix imagecache() and procenv() 2012-10-09 03:52:18 +02:00
man update fshalt(8) manpage 2012-10-14 13:33:10 +02:00
src kernel: attachimage / exec error handling 2012-10-14 19:48:46 +02:00