summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* fix a commentmickey2002-11-091-2/+2
|
* Move out the execution of vmcmds into a separate function.art2002-10-061-23/+2
|
* Add support for vmcmds that load sections relative to a base section.art2002-09-231-1/+14
| | | | | | | | 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
* Change the vnode locking in exec to not keep the vnode locked almost allart2002-08-221-12/+9
| | | | | | | | | | | | | | 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.
* Compare with the same type. ok deraadt@nordin2002-07-251-2/+2
|
* Instead of copying out the signal trampoline on top of the stack, createart2002-07-201-19/+62
| | | | | | | | | | | | | 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@
* Cause the exec to fail if we are unable to allocate resources when dup'ingmillert2002-05-021-7/+4
| | | | /dev/null to fd's 0-2 for a setuid program; deraadt@ and art@ OK
* invalid argv causes efault, not einval; form daniel@lucq.orgmickey2002-03-141-2/+2
|
* Enable stackgap_random. Set it initially to 1k.art2002-02-171-2/+2
|
* - Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't haveart2002-02-081-3/+3
| | | | | | | | | | | | | | 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)).
* When a process is exec:ing mark it with a flag. Check that flag in ptraceart2002-01-201-1/+10
| | | | | | 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.
* UBC was a disaster. It worked very good when it worked, but on someart2001-12-191-2/+1
| | | | | | | | | 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.
* Merge in the unified buffer cache code as found in NetBSD 2001/03/10. Theart2001-11-271-1/+2
| | | | | | | 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.
* Bring in more changes from NetBSD. Mostly pagedaemon improvements.art2001-11-121-2/+2
|
* Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.miod2001-11-061-2/+1
| | | | (Look ma, I might have broken the tree)
* - every new fd created by falloc() is marked as larval and should not be usedart2001-10-261-4/+8
| | | | | | | any anyone. Every caller of falloc matures the fd when it's usable. - Since every lookup in the fd table must now check this flag and all of them do the same thing, move all the necessary checks into a function - fd_getfile.
* merge vm/vm_kern.h into uvm/uvm_extern.h; art@ okmickey2001-09-191-3/+1
|
* It makes more sense to have argc stored as a long on the stack,art2001-08-251-2/+2
| | | | not int. Shouldn't affect any archs except sparc64 (now one step closer to a working userland).
* Add a possibility to add a random offset to the stack on exec. This makesart2001-08-181-4/+16
| | | | | | | | | | | | it slightly harder to write generic buffer overflows. This doesn't really give any real security, but it raises the bar for script-kiddies and it's really cheap. The range of the random offsets is controlled by the sysctl kern.stackgap_random (must be a power of 2). This is disabled by default right now, but we'll set it to a reasonable value (1024?) soon, after some more testing.
* remove old vmart2001-06-271-38/+1
|
* Try again. (this time it's tested).art2001-06-221-19/+8
| | | | | | Add proc_cansugid that checks if a process may raise it's privileges. Rework exec to remove the old sugid workaround and check proc_cansugid just before raising privileges.
* KNFderaadt2001-06-221-5/+5
|
* no way, you are on drugs. last commit revoked because it broke setuid majorlyderaadt2001-06-191-8/+19
|
* Check is sugid is allowed where we set the P_SUGID* flags.art2001-06-181-19/+8
| | | | Remove the ugly hack added in last revision.
* Avoid a dangerous race.art2001-06-151-1/+13
| | | | | | | | | | | | | | | | To avoid having a ptrace(2)d process from doing an exec of a suid binary we strip off the suid bits from the executable if the process is traced. Later we P_SUGID{,EXEC} in the process flags that stops further ptrace attempts. The problem is that between the stripping of suid bits and setting P_SUGID{,EXEC} there is a pretty large window where the process can sleep and other processes can attach to it with ptrace. This is a quick fix for that. We set P_SUGID{,EXEC} early and take care to remove them (we don't want the process to become tainted unnecessarily) if exec fails. XXX - exec needs a lot more work, but people are asking for a solution now.
* Add a macro to initialize the contents of a vmcmd set.art2001-04-011-4/+2
| | | | Correctly initialize the vmcmds in linux_exec.
* ELF uses more than 5 vmcmds by default, so grow the default vmcmd set sizeart2001-02-221-2/+3
| | | | | | | | | | | to 8. At the same time it seemed like a good idea to avoid to always malloc a new vmcmd array, so put the default sized array into struct exec_vmcmd_set. We might want to make a linked list of vmcmd arrays or exec_vmcmd_sets instead of reallocating them some time in the future, but right now this seems like a waste of time.
* support kernel event queues, from FreeBSD by Jonathan Lemon,provos2000-11-161-1/+6
| | | | okay art@, millert@
* Change the ktrace interface functions from taking the trace vnode to taking theart2000-11-101-2/+2
| | | | traced proc. The vnode is in the proc and all functions need the proc.
* When allocating the unallocated file descriptors 0, 1 and 2 for suid execs,art2000-09-281-8/+21
| | | | | | | | | | | | | | | | | don't do it by doing namei on /dev/null. The vnode for the executed file is locked and we had a race where other processes could lock the parent directories up to the root. When the executing process did the lookup on /dev/null it could deadlock on the root vnode while still holding the lock on the executed vnode. Also, it's really bad idea to depend on certain filesystem layout inside the kernel. Now we get the null device vnode by cdevvp(getnulldev(), ... Thanks to Matrin Portmann <map@infinitum.ch> for providing the (large) ktrace that allowed me to track this down. Fixes 1369.
* Don't use MALLOC/FREE on variable sized allocations.art2000-09-261-6/+6
|
* Add a function "ktrsettracevnode", that changes the ktrace vnode for a processart2000-04-201-3/+2
| | | | | in a correct way. Use it in all places where the vnode was changed. (most of the earlier code was incorrect and had races).
* Use the new timeout facilities for ITIMER_REAL.art2000-03-231-2/+2
|
* some more machine_stack_grows_upmickey2000-03-221-4/+4
|
* remove superflous declaration of vnops, it's now in <sys/file.h>assar2000-02-011-2/+1
|
* fix setregs call for bawkward stacks; does not affect straight casemickey2000-01-241-2/+6
|
* set[ug]id, not just setuidderaadt2000-01-201-3/+3
|
* when procfs is compiled in, if a setuid process has any of descriptors 0-2deraadt2000-01-201-15/+30
| | | | | | open for write on procfs, close it (and, thus, open a /dev/null instead); problem reported by nergal@idea.avet.com.pl, fix by me, thanks for help from millert
* do not NULL dereference if fd_nfiles < 3deraadt2000-01-191-2/+3
|
* more stack direction fixes; art@ okmickey1999-11-051-2/+16
|
* Stop profiling (see profil(2)) when we execve() a new process; ross@netbsd.orgmillert1999-08-091-1/+2
|
* Don't destroy sysvshm if the vmspace is shared (only affects uvm)art1999-07-151-2/+2
|
* vm_offset_t -> {v,p}addr_t ; vm_size_t -> {v,p}size_tart1999-07-151-5/+5
|
* introduce fdremove() to mark a file descriptor as unused. fdremove makesprovos1999-07-131-2/+2
| | | | | sure that the fd_freefile hints stay in sync, otherwise free file descriptors might not be overlooked by fdalloc(); ok millert@
* Improved sysv shared memory. Works with UVM.art1999-06-231-2/+2
| | | | | Original work done in FreeBSD, but this code was ported from NetBSD by Chuck Cranor.
* use __sparc__ just in casederaadt1999-06-031-2/+2
|
* uvmspace_exec can change p_vmspace!art1999-04-221-1/+6
|
* vm allocation changes for uvm.art1999-02-261-1/+30
| | | | Call uvmspace_exec instead of manually cleaning up.
* pretty up previous fixart1998-09-241-4/+6
|
* use the same flags for f_flag as there were used for vn_open, otherwise vn_close will not decrease v_writecount for the vnode causing panicsart1998-09-231-2/+2
|