summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
AgeCommit message (Collapse)Author
2009-07-09Remove the VREF() macro and replaces all instances with a call to verf(),Thordur I. Bjornsson
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.
2009-01-04properly terminate fake argument list.Thordur I. Bjornsson
From NetBSD; OK deraadt@
2008-10-31accidental commit ... backoutTheo de Raadt
2008-10-31kern_sysctl.cTheo de Raadt
2008-02-13Make sure we reserve enough stack space on MACHINE_STACK_GROWS_UP architecturesMark Kettenis
by aligning the stack gap. Fixes gettext port build (and probably many others). ok miod@, tedu@, tested by sthen@
2007-12-11Don't store arguments and environment in the space reserved for stackgap onMark Kettenis
machines where the stack grows up. Fixes systrace(1) on hppa. ok deraadt@
2007-10-29MALLOC/FREE -> malloc/freeCharles Longeau
replace an hard coded value with M_WAITOK ok krw@
2007-09-15replace ctob and btoc with ptoa and atop respectivelyMartin Reindl
help and ok miod@ thib@
2007-03-15Since p_flag is often manipulated in interrupts and without biglockArtur Grabowski
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
2007-03-01Remove two ancient debugging printfs.Artur Grabowski
2006-11-15typos; from bret lambertJason McIntyre
2006-01-19redo (w/ proper changes everywhere ;):Michael Shalayeff
take interp[MAXPATHLEN] off the stack. from mickey, ok otto while here, switch above from malloc to pool, remove stupid casts tedu@ miod@ ok
2005-12-07do not allow setugid processes to use /dev/fd/#, unless they are aTheo de Raadt
setuid-script and are attempting to dup is the specific setuid-script fd via such a pathname; ok tedu pedro millert
2005-12-03kernel support for threaded processes (rthreads).Ted Unangst
uses rfork(RFTHREAD) to create threads, which are presently processes that are a little more tightly bound together. several new syscalls added to facilitate a userland thread library. all conditional on RTHREADS, currently disabled. ok deraadt
2005-11-28ansi/deregister.Jonathan Gray
'go for it' deraadt@
2005-08-14catched->caughtMiod Vallat
2005-08-01 - We shouldn't allocate MAXPATHLEN from the stack.Artur Grabowski
- Don't copy the pathbuf into kernel space unless we're systracing. deraadt@ ok
2005-07-07clear vm_dused at exec time, since we are potentially re-using the vmspace;Theo de Raadt
fixes resource accounting in a mmap malloc world ok "too busy but looks right" tedu, tdeval
2005-04-11pull in new MD STACKGAP_RANDOMTheo de Raadt
2005-03-09Fail exec for disabled compat with EPERM rather than ENOEXEC.Miod Vallat
ok deraadt@ mickey@ millert@
2004-08-24back out the last change as it seems to produce problems found by brad@; ↵Michael Shalayeff
deraadt@ ok
2004-08-01leave space for stackgap on growsuppersMichael Shalayeff
2004-07-07fix an issue when scripts are exec'd under systrace wheremarius eriksen
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@
2004-06-23a few fixes to systracemarius eriksen
- 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
2004-06-11vm->vm_minsaddr was uninitialized (nothing realy uses it anyway)Michael Shalayeff
2004-05-14use pool for namei pathbuf. testing ok millert@ tdeval@Ted Unangst
2004-03-12don't leak memory on error, from Patrick LatifiTed Unangst
ok deraadt@ millert@
2004-02-05Decrement reference count in error case if uvm_map(9) fails and weTodd C. Miller
had previously increased the reference count. Should not happen, but... From dhartmei@; ok deraadt@
2003-09-01match syscallargs comments with realityHenning Brauer
from Patrick Latifi <patrick.l@hermes.usherb.ca> ok jason@ tedu@
2003-08-21emulation is now controlled by sysctl. changes:Ted Unangst
add e_flags to struct emul. this stores on/off and native flags. check for emul enabled in check_exec(). gather all the emuls into a emulsw so a sysctl can find them. create sysctl. move maxhdrsiz calcualation into init_main so it cleans up sys_execve codepath. teach sysctl utility to grok kern.emul hierarchy. requested and ok deraadt@ some comments from mickey@
2003-06-21add exec/fork/exit hooks per process for compat emulations.Ted Unangst
use them to correctly emulate linux brk. update to TNF copyright in linux_exec.c. from netbsd, mostly from a diff by Kurt Miller in pr3318. this should fix java. no regressions in testing by kurt and sturm@. be prepared for "proc size mismatch" -- recompile ps and friends. ok deraadt@
2003-06-02stackgap_random becomes 64KTheo de Raadt
2003-05-17Typos; from Julien Bordet <zejames@greyhats.org>Alexander Yurchenko
Close PR 3262
2003-04-14There are two related changes.Artur Grabowski
The first one is an mquery(2) syscall. It's for asking the VM system about where to map things. It will be used by ld.so, read the man page for details. The second change is related and is a centralization of uvm_map hint that all callers of uvm_map calculated. This will allow us to adjust this hint on architectures that have segments for non-exec mappings. deraadt@ drahn@ ok.
2003-03-09Make the semantics of the P_SUGIDEXEC flag match the issetugid(2)Todd C. Miller
man page. Instead of just clearing P_SUGIDEXEC if real and effective uids/gids matched, we now set P_SUGIDEXEC if there is a mismatch in the real, effective, or saved uid/gid and clear it otherwise. deraadt@ and tholo@ OK.
2002-12-11descructive -> destructiveMiod Vallat
2002-12-04No need to exit the process twice. exit1() can't fail.Artur Grabowski
2002-11-09fix a commentMichael Shalayeff
2002-10-06Move out the execution of vmcmds into a separate function.Artur Grabowski
2002-09-23Add support for vmcmds that load sections relative to a base section.Artur Grabowski
You mark one section with VMCMD_BASE and the rest are marked RELATIVE. Use that to load ELF interpreter correctly in all cases. Inspired by NetBSD. Great debugging help from drahn@ deraadt@ ok
2002-08-22Change the vnode locking in exec to not keep the vnode locked almost allArtur Grabowski
the time. This could lead to problems when a process wants to do an exec on the same vnode it's being run from and needs to copy in arguments from an uncached page in the data segment. When that happens uvm detects a vnode deadlock and returns an error causing execve() return EFAULT. This fixes the regress test in regress/sys/kern/exec_self Also, initialize scriptvp early in exec_script because it could be used uninitialized in a failure case.
2002-07-25Compare with the same type. ok deraadt@Thomas Nordin
2002-07-20Instead of copying out the signal trampoline on top of the stack, createArtur Grabowski
an uvm aobj, copy out the signal trampoline into it and share that page among all processes for the same emulation. This also requires us to actually be able to tell signal code where the trampoline is located, so introduce a new field in struct proc - p_sigcode that is a pointer to sigcode. This allows us to remove all the ugly calculations of the signal trampoline address done in every sendsig function in the tree (that's why so many files are changed). Tested by various people. ok deraadt@
2002-05-02Cause the exec to fail if we are unable to allocate resources when dup'ingTodd C. Miller
/dev/null to fd's 0-2 for a setuid program; deraadt@ and art@ OK
2002-03-14invalid argv causes efault, not einval; form daniel@lucq.orgMichael Shalayeff
2002-02-17Enable stackgap_random. Set it initially to 1k.Artur Grabowski
2002-02-08- Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't haveArtur Grabowski
the same semantics as NetBSD anyway, so it's good to avoid name collissions. - Always fdremove before freeing the file, not the other way around. - falloc FREFs the file. - have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to falloc FREFing the file). - Use closef as much as possible instead of ffree in error paths of falloc:ing functions. closef is much more careful with the fd and can deal with the fd being forcibly closed by dup2. Also try to avoid manually calling *fo_close when closef can do that for us (this makes some error paths mroe complicated (sys_socketpair and sys_pipe), but others become simpler (sys_open)).
2002-01-20When a process is exec:ing mark it with a flag. Check that flag in ptraceArtur Grabowski
and procfs (and possibly more places in the future) and simply refuse to fiddle with the execing process. This is an ugly hack, but this far we haven't been successful in creating a race-free exec.
2001-12-19UBC was a disaster. It worked very good when it worked, but on someArtur Grabowski
machines or some configurations or in some phase of the moon (we actually don't know when or why) files disappeared. Since we've not been able to track down the problem in two weeks intense debugging and we need -current to be stable, back out everything to a state it had before UBC. We apologise for the inconvenience.
2001-11-27Merge in the unified buffer cache code as found in NetBSD 2001/03/10. TheArtur Grabowski
code is written mostly by Chuck Silvers <chuq@chuq.com>/<chs@netbsd.org>. Tested for the past few weeks by many developers, should be in a pretty stable state, but will require optimizations and additional cleanups.