check for write premission in the parent directory
for open with ORCLOSE. honor CHFNOPERM not just in
chancreat(), pikeshedd the error handling. added
estrdup()/erealloc() that call sysfatal instead
of returning nil.
getdent() introduced a bug as the qid check fails in
the case when we walk to DUMPROOTQID, but get ROOTQID
in the directory instead.
newentry() getblk(..., GBCREATE) caused the whole
directory to get dumped until it hit a free slot.
we cannot do this because this changes the addresses
of Dentries of files but doesnt update the loctree.
this caused the bogus walks when we hit a different
directory than we expected.
what we do now is the following: newentry() was changed
to never dump anything. it will just read the directory
and return a the address of a free slot or create a
new block having space for one. chancreat() then makes
a loc in the loctree for the free slot, drops the dirent
buffer and calls willmodify() on the new slot. this will
dump the block containing the slot (and possible other
slots) and updates the loctree to the new version.
after that, chancreate() modifies the slot filling the
Dentry. there should be no race, as newentry() skips
slots that have a loc in the loctree.
theres one case where newentry() can dump the block
immidiately when it is called from dump. added new
parameter for that and documented in the comment.
createuserdir() was simplified by just calling chancreat().
to get arround the permission check, a new per channel
flag CHFNOPERM was added.
always check if the directory entry qid from the loc still
matches the one on disk before doing anything. helps
catching bugs and is basically equivalent to what cwfs does
with its checktag.
make a haveloc() check in newentry() to make sure we dont
allocate a file slot thats still in use, but deleted.
this seems to fix the NPROC>1 build problems.
This patch adds client TLS authentication to libsec in compliance with
rfc 4346.
A new -c flag has been introduced for tlsclient allowing the user to
specify a certificate in pem(8) format which will be provided to the
server upon request.
A -D debug flag has been introduced to enable debugging output.
The patch has been tested against OpenSSL 0.9.7j 04 May 2006.
It exists today because of the great (debugging) help and insight
provided by Matthias Bauer.
TODOs:
- specification of a certain client key in factotum is not possible at
the moment
- tlssrv should support this too
These will get added in another patch.
The first try to submit this patch failed due to a network error.
Sorry for the duplication!
Kind regards,
Christian
newproc() didnt zero parentpid and kproc() didnt set it, so
kprocs ended up with random parent pid. this is harmless as
kprocs have no up->parent but it gives confusing results in
pstree(1).
now we zero parentpid in newproc(), and set it in sysrfork()
unless RFNOWAIT has been set.
assuming that this check tried to prevent the hostowner
from killing init, it is silly because init would just
handle the note.
with kbdfs, we actually want to send interrupt note to
the initial process group so instead of working arround
this with rfork(RFNOTEG|RFNAMEG), we remove the check.
these changes make the interrupt key available in the
console (before rio is started).
kbdfs: will now send a "interrupt" note to its invoking
process group in cooked mode.
bootrc: is now prepared to handle interrupts, mainly to
not accidently spawn a new bootargs prompt.
init: forwards the interrupt to the cpurc/termrc pgrp.
vncs: shields itself from kbdfs notegroup so interrrupt
wont kill the whole vnc session.
functional identical, but uses different data structure.
instead of reading all words into memory, we read and
tokenize on demand keeping a simple linked list of words
to conume by further calls of getword(). once the list
is empty we read the next line, tokenize it and fill the
list up again. so we only need as mutch memory to hold
all the words of the longest line.
we can't really change the Window *input from
outside the winctl() thread. the problem is
that the window might end up reading the
mouse (scroll, select) which makes the w->cctl
channel block once you try to talk to the
window again (from the mousethread). this also
means we have to coordinate window switchin
from the winctl proc waiting for the current
window to release the input and then take over.
thers a new Winctl message Topped that basically
does that now using Wakeup and a chan to
synchronize.
wrepaint() used to also set the cursor for the window
if it was current. this reset the corner cursors on
bandresize when one tried to attempt to size a window
that was not current. make repaint just repaint the
window and border. set cursor explicitely for hold
toggle.
use notefd in killprocs() insead of postnote() as the process
might'v exited. the notefd stays valid even if the particular
process it was originaly opend on exited. remove the Window.pid
field as its not needed.
dup() the notefd for interruptproc as the window might'v gone
away and closed the notefd file descriptor, resulting in us
writing to the wrong thing.
use snprint() instead of sprint() for safety.
fix bogus debug fprint().
add missing "visible" flushimage() after Reshaped winctl message
got handled. i assumed wsetname()/nameimage() would be enough,
it but does a invisible flush so softscreen doesnt get updated
immidiately.
do not make allocimage() failure in scrtemps() fatal. it wont
draw the window properly, but it gives the user a chance to
delete some windows to recover.
allocate all the colors in iconinit(), remove unused ones
like grey. rename darkgrey to paletextcol because thats
what it is used for. new approach to window image allocation.
we allocate the window with DNofill and let the window fill
itself. this reduces flickering especially with (-b) option
and makes rio resize feel a lot faster.
wrefresh() didnt work. now fixed.
wtop() checked w->topped == topped as a fast exit. if you
had the top most window not being current (== input) which
can happen when you delete the current window, then wtop would
after resize would not make the window current because it
is already top topmost one. wtopme() and wcurrent() both are
non-ops when window is already the topmost or window is already
current, so remove the check as its not needed. also topping
the window feels less sluggish.
sort the window array by w->topped before reshaping all
windows. this preserves the window z-order.
remove implicit focus change on reshape/move. it called
wcurrent() in wtcl thread which might send a wctl message
to itself, bad... also we might not want to change focus
on reshape, like for the rio resize. so we set the input
window explicitely in all call sites.
window deletion was racy. wclosewin() destroys w->i, but
it is called outside the wctl thread so it might just
free the image under libframe doing some text selection.
this is fixed the following: add wclunk() function,
which basically just marks the window as deleted and
removes the reference from the window[] and hidden[]
arrays. (called on wclose() when refcount drops to
zero). wclosewin() now just frees the image and is only
called from the wctl thread on exit or when handing
the Deleted message.
get a reference to the window when doing sweeping or
moving as the filesystem might just clunk it under
us and we might end up sending wctl messages to
a Exited window.
wctl resize message has to fail if the window is not
current as it might be hidden... would also be annoying.
this is to catch crazy color channels like k8a8 and the 15/16 bit
ones and CMAP. basically, just convert to RGBA32 or RGB24 depending
on if it has an alpha channel.
as the menu is displayed, the window might go away or change its
label causing menuhit() to dereference bad memory. just strdup()
the labels before passing to menu3str to prevent accidents.
avoid double entries in the cache for copen() and properly handle
locking so we wont just give up if we cant lock the Mntcache entry,
but drop the cache lock, qlock the Mntcache entry, and then recheck
the cache.
general cleanup (cdev -> ccache, use eqchantdqid())
the lock order of page.Lock -> palloc.hashlock was
violated in cachedel() which is called from the
pager. change the code to do it in the right oder
to prevent deadlock.
change lookpage to retry on false hit. i assume that
a false hit means:
a) we'r low on memory -> cached page got uncached/reused
b) duppage() got called on the page, meaning theres another
cached copy in the image now.
paging in is expensive compared to the hashtable lookup, so
i think retrying is better.
cleanup fixfault, adding comments.
swaped pages use a 8bit refcount where as the Page uses a 16bit one.
this might be exploited with having a process having a single page
swaped out and then forking 255 times to make the swap map refcount
overflow and panic the kernel.
this condition is probably very rare. so instead of doubling the
size of the swap map, we add a single 32bit refcount swapalloc.xref
which will keep the combined refcount of all swap map entries who
exceeded 255 references.
zero swapimage.c in setswapchan() after closing it as the stat() call
below might error leaving a dangeling pointer.
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.
kstrcpy() did not null terminate for < 4 byte buffers. fixed,
but i dont think there is any case where this can happen in
practice.
always set malloctag in kstrdup(), cleanup.
always use ERRMAX bounded kstrcpy() to set up->errstr, q->err
and note[]->msg. paranoia.
instead of silently truncating interface name in netifinit(),
panic the kernel if interface name is too long as this case
is clearly a mistake.
panic kernel when filename is too long for addbootfile() in
devroot. this might happen if your kernel configuration is
messed up.
When running "?c -p ...", ensure the backend cpp recognizes C++ comments.
2c(1) states that the compilers recognize // comments, and the bare compilers
do. But if you invoke the compiler with '-p', the backend cpp process
doesn't handle // comments properly unless you also give ?c the undocumented
'-+' option (which it passes through to cpp).
in devproc status read handler the p->status, p->text and p->user
could overflow the local statbuf buffer as they where copied into
it with code like: memmove(statbuf+someoff, p->text, strlen(p->text)).
now using readstr() which will truncate if the string is too long.
make strncpy() usage consistent, make sure results are always null
terminated.
use fastclock timer (pit2) to measure cpufreq in guesscpuhz(). this
gives a bigger period minimizing the danger of overrun as pit2 runs
at the constant maximum period of 0x10000 ticks. also use smaller
loop increments (1000) and bigger maximum loop upper bound.
move the loops < ... check to the bottom of the loop so we get the
effective count *before* adding the next loop increment.
ilock() while doing measurements in guesscpuhz() to prevent accidents
with other processors reading fastclock or doing guesscpuhz()
in parralel.
export new i8253reset() function for apm to reset the timers after
a apm bios suspend.
we have to acquire p->seglock before we lock the individual
segments of the process and lock them. if we dont then pexit()
might free the segments before we can lock them causing the
"qunlock called with qlock not held, from ..." prints.
* disallow snarf on password entries
* remove current title label as it is displayed in the page list (redundant)
* avoid redrawing page list just to update the title
* check if the chan changed for backup bitmap in pl_rtdraw()
send ACK reply for duplicate data packets in case our ack response
got lost. make sure packets are in sequence and ignore out of
oder packets (except the ones we'v already acked).
to make it easy to use normal libraries (such as libdraw, libsec, and libmp)
with the kernel, which uses extern register, don't stray into the external
register set when allocating values to registers.
sometimes, the bios does not assign a interrupt line for pci
devices. this should not be fatal in case of mp ineterrupts
as long as there is intpin or msi can be used.
warn in intrenable() if we hit such a interrupt and set
irq to -1 to prevent it from getting enabled on the pic
or as isa interrupt in apic mode.
removing the querylck from the DN as it was never used or being
effective which saves like a ton on space per domain name.
remove the Query.tcplock and put query on the stack. it is
unneccesary to lock the query as its only used by one process
at a time. put Query's on the stack.
change outsidens() to outsidensip() which now takes the ip
buffer that it fills instead of returning static buffer (which
would race with multiple processes involved).
eleminate mostly all of the lock(&dnlock)/unlock(&dnlock) calls.
we'r not working on shared cache RR's in the resolver procs.
we work on *copies* done by rrlookup() made under the dnlock.
the cache garbage collection only runs when all processes are
locked out and is also taking the dnlock while doing so.
cleanup xmitquery(). for the tcp case, we dont need to get
more nameserver addresses, just take the ip from the udp header
that tcpquery() placed there for us.
fixed baddelegation() to actually check for delegation loop even
if theres no dom info for our host.
remove lots of debug code. remove the dnforceage() as it doenst
make sure other processes are locked out. this could destroy
dn's currenctly refered by running queries.
remove dnageallnever() as its not used. dont attach rr's to
keepers to prevent outside spoofing.
make myaddr() retrive the ip address if not set.
we used to only test the checksum of the PCMP structure referenced by
the _MP_ without checking _MP_ itself. now fixed.
geoff added some coherence() calls and comments in the mpstartup and
apic code which seems to be a good idea.
replace the various functions that searched for bios data structures by
a single sigsearch() one in pc/memory.c that will probe the various bios
data areas.
also, a new checksum() function was added that is to be used to validate
the structures found.
always make sure that there are child processes we can wait for
before sleeping.
put pwait() sleep into a loop and recheck. this is not strictly
neccesary but prevents accidents if there are spurious wakeups
or a bug.
once we set q->done = 1 in mountmux, the sleeper might return freeing q
so the wakeup might access invalid memory. we change the embedded Rendez
structure in the Mntrpc into a pointer to the sleeping procs up->sleep
rendez so the rendez is always going to be valid even if the rpc has been
freed.
the call to mntstats was moved before we set q->done also to prevent
accessing invalid memory.
wakeup cannot access r->sleep once we set r->done because the
sleeper might just return at this point making r invalid. make
a copy of the sleep rendez pointer before setting r->done.