Commit graph

2129 commits

Author SHA1 Message Date
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
cinap_lenrek 2f416353df libmach: fix file permission for map.c 2012-11-22 00:56:32 +01:00
cinap_lenrek 5be7e69c26 hgfs: work in progress stuff... 2012-11-22 00:02:43 +01:00
cinap_lenrek 1d4ab25265 hgfs: remove bogus OTRUNC mode from create() call in fmktemp() 2012-11-21 19:28:40 +01:00
cinap_lenrek 40d11cea3f hgfs: various improvements
lazily close revlog files and keep up to 8
revlogs arround. also cache the latest extracted
file descriptor of a revision in the revlog.
this avoids the quite expensive reextracting/patching
when we reopen the same file revision.

dont use the racy mktemp()/create, instead create
a uniqueue name and create with OEXCL. this also
avoids a bunch of access() calls.

fix eof case and use pread() in fcopy() to avoid the
seeks.

dont modify changelog temp file but simulate trailing
newline instead.
2012-11-21 19:22:46 +01:00
cinap_lenrek 73744b9f48 derp: handle file type changes
handle cases when files become directories or directories
become files.
2012-11-21 15:34:12 +01:00
cinap_lenrek f188f2f073 hjfs: eleminate seek syscalls
reduce syscalls by using pread/pwrite instead
of seek/read/write.
2012-11-18 12:53:31 +01:00
cinap_lenrek 68639edbad merge 2012-11-18 12:02:36 +01:00
cinap_lenrek c1d5963850 merge 2012-11-18 12:01:16 +01:00
cinap_lenrek bcaf52ebcd hjfs: ORCLOSE parent check, estrdup / erealloc, CHFNOPERM consistency
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.
2012-11-18 12:00:13 +01:00
cinap_lenrek 28452d3fe5 hgfs: work in progress stuff 2012-11-18 11:54:04 +01:00
cinap_lenrek f286eda587 merge 2012-11-18 01:12:27 +01:00
cinap_lenrek 9a39427183 hjfs: fix dump / create
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.
2012-11-18 00:06:54 +01:00
stanley lieber cb8d49e3c2 fortunes: did anyone at iwp9 give an update about osprey? anyone ask when it'll be available? 2012-11-17 14:24:01 -06:00
cinap_lenrek 08cd0ea8d4 hjfs: fix getfree() races, fix very rare buf leak in deltraverse() 2012-11-16 22:57:43 +01:00
cinap_lenrek 84ddc4cd4b hjfs: fix potential deadlock in putloc() 2012-11-16 19:55:58 +01:00
cinap_lenrek b9bf9f1d54 hjfs: dentry qid checking, prevent newentry() from allocating already in use slot
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.
2012-11-16 13:42:45 +01:00
cinap_lenrek ffa6f9c6ea fix spaces 2012-11-15 19:41:13 +01:00
cinap_lenrek b28f60cdd3 add C-Keens tls-client-auth
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
2012-11-15 19:32:53 +01:00
cinap_lenrek df829e6c07 hjfs: fix more missing dirty marks, error handling, cleanup 2012-11-15 16:43:35 +01:00
cinap_lenrek 7ced300071 hjfs: fix missing BDELWRI mark in newentry() 2012-11-15 09:22:13 +01:00
cinap_lenrek e96b16ee7f merge 2012-11-12 07:01:25 +01:00
cinap_lenrek 1f02aabc6b tap: various improvements
dont use sed pipeline for indention, cache process arguments,
get process list once at start.
2012-11-12 02:12:05 +01:00
stanley lieber 1f0260b5f8 ssam: add usage 2012-11-10 21:24:58 +00:00
cinap_lenrek 00daf47137 vt: on resize, restore screen using history buffer 2012-11-10 07:56:39 +01:00
cinap_lenrek 0ad8548b70 rio: fix auto compmplete candidates getting read back without prompt 2012-11-10 02:30:17 +01:00
cinap_lenrek 0df3f94ecd kbdfs: send interrupt note in separate proc to prevent potential deadlock 2012-11-09 17:39:35 +01:00
cinap_lenrek 663aff7fb2 kbdfs: kill input buffer on interrupt key 2012-11-09 17:09:20 +01:00
cinap_lenrek 01d28b9d89 pstree: manpage, print pid in first column, bio, silly walks 2012-11-08 00:06:54 +01:00
cinap_lenrek 6f1efd37a2 limit clunk queue length for cclose()
dont let the clunk queue grow too large if we are allowed to
block (cclose) as the fileserver might run out of fids.
2012-11-07 22:04:29 +01:00
cinap_lenrek 52f71a17da pstree: sort children, fix missing close, strip newline from args 2012-11-07 21:14:41 +01:00
cinap_lenrek 6c8097a84d fix spurious kproc ppid
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.
2012-11-07 20:46:30 +01:00
cinap_lenrek 479ea049e3 remove tty(1) command as kbdfs now handles interrupts 2012-11-07 19:04:26 +01:00
cinap_lenrek 2c4a77f21f devproc: remove pgrpid == 1 check for notepg open
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.
2012-11-07 18:57:02 +01:00
cinap_lenrek eb96892d85 merge 2012-11-06 17:21:15 +01:00
cinap_lenrek 599dd1c34f make interrupt key (Del) just work in the console
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.
2012-11-06 17:19:41 +01:00
iru 2dbc08a8bc Oops, make exponential function work 2012-11-05 15:47:13 -02:00
iru c8ea1cd8d7 Add exponential function. 2012-11-05 15:45:10 -02:00
iru 0c9237e0b4 fplot(1) man page 2012-11-05 15:38:39 -02:00
cinap_lenrek 120412a6a2 wikifmt: fix trailing _ in heading name reference 2012-11-05 03:16:13 +01:00
cinap_lenrek 72679fd6cc add google code wiki formatter aux/wikifmt 2012-11-05 02:39:33 +01:00
cinap_lenrek 4d1f113490 derp(1) spelling (thanks pap) 2012-11-02 22:15:17 +01:00
cinap_lenrek c0c2660f74 add directory-examining recursive compare derp(1) 2012-11-02 20:28:12 +01:00
cinap_lenrek 5cb6be9ce3 hgfs: fix metaheader offset for log 2012-11-02 03:31:55 +01:00
cinap_lenrek ce59d96ee3 hjfs: fix group permissions for /adm and /adm/users for init 2012-11-01 16:34:33 +01:00
cinap_lenrek 4b2a1c104b hgfs: strip metadata header, bogus .n walks 2012-11-01 03:42:24 +01:00
cinap_lenrek 30d54cc055 rio: fix topping a hidden window does not activate the foreground font color 2012-10-30 23:18:53 +01:00
cinap_lenrek 559d2fc835 hgfs: work in progress stuff... 2012-10-29 22:00:38 +01:00
cinap_lenrek 6812f4679b hgfs: more work in progress stuff 2012-10-28 23:18:38 +02:00
cinap_lenrek 90cbdce8ab devdraw: fix stats for #i/winname (thanks jas) 2012-10-27 22:27:19 +02:00