summaryrefslogtreecommitdiffstats
path: root/sys/dev/systrace.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add struct proc * argument to FRELE() and FILE_SET_MATURE() inguenther2012-04-221-2/+2
| | | | | | anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
* First steps for making ptrace work with rthreads:guenther2012-02-201-4/+4
| | | | | | | | | | - move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and p_ptstat member from struct proc to struct process - sort the PT_* requests into those that take a PID vs those that can also take a TID - stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT ok kettenis@
* Hold struct filedesc's fd_lock when writing to the fd_ofiles, fd_ofileflags,guenther2012-02-151-1/+3
| | | | | | | | or fd_{lo,hi}maps members, or when doing a read for a write. Fixes hangs when an rthreaded processes sleeps while copying the fd table for fork() and catches another thread with the lock. ok jsing@ tedu@
* Add support for *at(2) system calls to systrace(1).matthew2011-09-181-7/+23
| | | | ok deraadt@, sthen@, jasper@
* Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls,guenther2011-07-111-12/+2
| | | | | | as it causes hangs in some ports, including libsigsegv's configure script confirmed by krw@, landry@
* There is a bunch of places in the kernel entry points where we don'tart2011-07-071-2/+12
| | | | | | | | | | | hold the kernel lock, but still need call one function that needs it. Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse. kettenis@, beck@ ok
* printf -> DPRINTF in the SIGKILL pathdjm2011-06-241-2/+3
|
* ansify a few files. ok deraadt dlg krw matthewtedu2011-06-231-46/+13
|
* Add a SYSTR_POLICY_KILL per-syscall policy option that sends SIGKILL todjm2011-06-221-4/+10
| | | | | | | | | the traced process when the syscall is attempted. This is more useful and safer for unsupervised sandboxing than returning EPERM (which is the behaviour of SYSTR_POLICY_NEVER), as this could cause dangerous misbehaviour in applications that don't expect it. "I like it" deraadt@ markus@
* Move P_SUGID and P_SUGIDEXEC from struct proc to struct process, soguenther2011-04-021-12/+10
| | | | | | that you can't evade the checks by doing the dirty work in an rthread ok blambert@, deraadt@
* No need for read/write functions, just use enodev like all the otherderaadt2010-07-211-31/+1
| | | | | things things do ok nicm
* Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tnicm2009-11-091-2/+1
| | | | | | | | | | supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and remove it from any occurences where both are used, except one for kqueue itself and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag). Based on a diff from tedu. ok deraadt
* Add missing KNOTE() calls after selwakeup(), until we decide if the KNOTE()deraadt2009-10-311-1/+2
| | | | | | | calls can go directly into selwakeup() safely long discussion with nicm, murmers of consent from tedu and miod, noone else seems to care of kqueue is busted as long as it makes their sockets move data fast... pretty sad.
* Remove the VREF() macro and replaces all instances with a call to verf(),thib2009-07-091-3/+3
| | | | | | | | | | | which is exactly what the macro does. Macro's that are nothing more then: #define FUNCTION(arg) function(arg) are almost always pointless and should go away. OK blambert@ Agreed by many.
* systrace activation happens in the middle of a rather sensitive piece ofderaadt2008-11-091-24/+39
| | | | | | | fork(), i worry about it a lot but cannot prove yet that sleeping there is bad. Anyways, this change makes us never sleep in that area -- the memory needed is allocated ealier like the ptrace state. tested by many developers.
* Remove bzero/memset calls after pool_gets by passing the PR_ZEROblambert2008-09-121-5/+3
| | | | | | flag to the pool_get call. ok art@, krw@
* return with ENOTTY instead of EINVAL for unknown ioctl requests.brad2008-01-051-3/+3
| | | | ok krw@ deraadt@ dlg@
* KNFgilles2007-09-111-2/+2
| | | | prompted and "much better" by marco@, ok pyr@
* more MALLOC/FREE -> malloc/free and M_ZERO changesgilles2007-09-101-7/+5
| | | | ok pyr@
* Since p_flag is often manipulated in interrupts and without biglockart2007-03-151-6/+6
| | | | | | | | | | | | it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int. Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way. kettenis@ ok
* fix an exploitable integer overflow found by Chris Evans of Googledjm2006-10-061-3/+14
| | | | Security; ok deraadt
* Allow len == 1 in systrace_fname(), so systraced processes can proceedpedro2006-05-281-2/+2
| | | | | | | | | | their *stat() calls, for example, and get ENOENT, which is expected for "", instead of a forced EINVAL. Fixes the spurious 'rm: : Invalid argument' warnings when building with option USE_SYSTRACE, reported on ports@. Okay provos@ sturm@ deraadt@
* Replace lockmgr with rwlock; 'i think so' tedu@, ok sturm@alek2006-05-231-34/+34
|
* Replace procfs_domem() with a similar interface, process_domem(), which livesmiod2005-12-111-4/+3
| | | | | | | out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm(). From art@ some time ago; ok kettenis@ pedro@
* Remove unnecessary lockmgr() archaism that was costing too much in termspedro2005-11-191-31/+30
| | | | | | of panics and bugfixes. Access curproc directly, do not expect a process pointer as an argument. Should fix many "process context required" bugs. Incentive and okay millert@, okay marc@. Various testing, thanks.
* Intermediate cast of strio_offs -> uio_offset should be u_long not longmillert2005-04-171-2/+2
| | | | | since otherwise a very high kernel address would be stored as a negative offset. From NetBSD (christos).
* add a new message: inject. this allows the tracer to to inject buffers intomarius2004-11-071-12/+89
| | | | | | | the stackgap. this in turn allows for argument replacement with indirection. for example replacing an entire envp or struct pollfd. ok provos@ millert@
* fix an issue when scripts are exec'd under systrace wheremarius2004-07-071-31/+108
| | | | | | | | | the argv[0] would be normalized, and hence break scripts that depend on how they were called. this fixes an issue in the ports builds. ok provos@ deraadt@; lots of testing during hackathon sturm@ naddy@
* a few fixes to systracemarius2004-06-231-18/+61
| | | | | | | | | | | | - add an exec message so that whenever a set-uid/gid process exec's a new image which we may control, the exec does not go by unnoticed. - take special care to check for P_SUGIDEXEC as well as P_SUGID, corresponding to the same changes that were made in the ptrace code a while ago ok niels@, sturm@; thanks to naddy for testing
* typos from Tom Cosgrove;jmc2003-10-211-3/+3
|
* originally from cb@netbsd.org, adapted by provossturm2003-10-081-72/+144
| | | | | | | | | | | | | itojun@ ok fix a race condition between path resolution in userland and the subsequent namei(): inform the kernel portion of valid filenames and then disallow symlink lookups for those filenames by means of a hook in namei(). with suggestions from provos@ also, add (currently unused) seqnr field to struct systrace_replace, from provos@
* Replace select backends with poll backends. selscan() and pollscan()millert2003-09-231-14/+16
| | | | | | | now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
* change arguments to suser. suser now takes the process, and a flagstedu2003-08-151-3/+3
| | | | | | | | | argument. old cred only calls user suser_ucred. this will allow future work to more flexibly implement the idea of a root process. looks like something i saw in freebsd, but a little different. use of suser_ucred vs suser in file system code should be looked at again, for the moment semantics remain unchanged. review and input from art@ testing and further review miod@
* - limited number of processes per systraceitojun2003-06-161-4/+43
| | | | | - escape fixes for special characters markus, sturm ok. from provos
* unbreakhenning2003-03-281-2/+1
| | | | | | STRIOCCLONE and SYSTR_CLONE have the same value now ok mickey@
* Fix a crash in the systrace found by form@art2003-02-201-55/+57
| | | | | | | One is a kernel fix that changes the lockin and one is a userland fix that prevents dereferencing a freed pointer. From provos deraadt@ ok
* statement after label.art2002-12-121-1/+2
|
* rename the clone ioctl to avoid clashing w/ the sockio; provos@ okmickey2002-12-041-1/+2
|
* Be more careful with illegal syscall numbers.art2002-11-101-1/+6
|
* add id tags.fgsch2002-10-251-0/+1
|
* support for privilege elevation.itojun2002-10-161-56/+152
| | | | | | | | | | | with privilege elevation no suid or sgid binaries are necessary any longer. Applications can be executed completely unprivileged. Systrace raises the privileges for a single system call depending on the configured policy. Idea from discussions with Perry Metzger, Dug Song and Marcus Watts. from provos
* new message to track uid/gid changesitojun2002-10-091-0/+32
| | | | from provos
* cast size_t to u_long on printing. from netbsditojun2002-08-281-4/+4
|
* return EBUSY in processreadyprovos2002-08-071-2/+2
|
* minor KNF. pid_t is unsigned.itojun2002-07-301-6/+6
|
* whitespace at EOLitojun2002-07-301-10/+10
|
* better uid/gid tracking; okay deraadt@provos2002-07-241-5/+18
|
* prevent double free in some error conditions; from xs@kittenz.orgprovos2002-07-231-1/+3
|
* add seqnr to message from kernel, userland needs to quote correct seqnr.provos2002-07-221-0/+9
| | | | avoids problems where tsleep has been interrupted by a signal.
* two more missing systrace_lockitojun2002-07-211-0/+4
|