summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a P_INEXEC flag that indicates that the process has called execve() anddes2001-10-271-15/+25
| | | | | | | | it has not yet returned. Use this flag to deny debugging requests while the process is execve()ing, and close once and for all any race conditions that might occur between execve() and various debugging interfaces. Reviewed by: jhb, rwatson
* Use vm_offset_t instead of caddr_t to fix a warning and removerobert2001-10-241-3/+3
| | | | two casts.
* Fix ktrace enablement/disablement races that can result in a vnodedillon2001-10-241-3/+7
| | | | | | | | ref count panic. Bug noticed by: ps Reviewed by: ps MFC after: 1 day
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderps2001-10-101-5/+5
| | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks
* Move setregs() out from under the PROC_LOCK so that it can use functionsdfr2001-10-101-4/+4
| | | | list suword() which may trap.
* proces -> process in a comment.jhb2001-10-091-1/+1
|
* KSE Milestone 2julian2001-09-121-19/+24
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Pushdown Giant for acct(), kqueue(), kevent(), execve(), fork(),dillon2001-09-011-5/+10
| | | | vfork(), rfork(), jail().
* Fix a simple typo I just happened to find.alex2001-08-221-1/+1
|
* Correct spelling in a comment and remove trailing newline from add2001-07-111-2/+2
| | | | panic() call (panic() adds it itself).
* Don't share sig handlers after an execguido2001-07-091-1/+23
| | | | Reviewed by: Alfred Perlstein
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-07-041-6/+4
| | | | | | | | | (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
* Fix some lock order reversals where we called free() while holding a procjhb2001-06-201-9/+11
| | | | | | lock. We now use temporary variables to save the process argument pointer and just update the pointer while holding the lock. We then perform the free on the cached pointer after releasing the lock.
* Move setugid() a little sooner to before we release tracing in casepeter2001-06-161-2/+3
| | | | crdup() or change_e*id() block on malloc() or mutex.
* o pcred-removal changes included modifications to optimize the setting ofrwatson2001-05-261-7/+8
| | | | | | | | | | | | the saved uid and gid during execve(). Unfortunately, the optimizations were incorrect in the case where the credential was updated, skipping the setting of the saved uid and gid when new credentials were generated. This change corrects that problem by handling the newcred!=NULL case correctly. Reported/tested by: David Malone <dwmalone@maths.tcd.ie> Obtained from: TrustedBSD Project
* o Merge contents of struct pcred into struct ucred. Specifically, add therwatson2001-05-251-11/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real uid, saved uid, real gid, and saved gid to ucred, as well as the pcred->pc_uidinfo, which was associated with the real uid, only rename it to cr_ruidinfo so as not to conflict with cr_uidinfo, which corresponds to the effective uid. o Remove p_cred from struct proc; add p_ucred to struct proc, replacing original macro that pointed. p->p_ucred to p->p_cred->pc_ucred. o Universally update code so that it makes use of ucred instead of pcred, p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo, cr_{r,sv}{u,g}id instead of p_*, etc. o Remove pcred0 and its initialization from init_main.c; initialize cr_ruidinfo there. o Restruction many credential modification chunks to always crdup while we figure out locking and optimizations; generally speaking, this means moving to a structure like this: newcred = crdup(oldcred); ... p->p_ucred = newcred; crfree(oldcred); It's not race-free, but better than nothing. There are also races in sys_process.c, all inter-process authorization, fork, exec, and exit. o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid; remove comments indicating that the old arrangement was a problem. o Restructure exec1() a little to use newcred/oldcred arrangement, and use improved uid management primitives. o Clean up exit1() so as to do less work in credential cleanup due to pcred removal. o Clean up fork1() so as to do less work in credential cleanup and allocation. o Clean up ktrcanset() to take into account changes, and move to using suser_xxx() instead of performing a direct uid==0 comparision. o Improve commenting in various kern_prot.c credential modification calls to better document current behavior. In a couple of places, current behavior is a little questionable and we need to check POSIX.1 to make sure it's "right". More commenting work still remains to be done. o Update credential management calls, such as crfree(), to take into account new ruidinfo reference. o Modify or add the following uid and gid helper routines: change_euid() change_egid() change_ruid() change_rgid() change_svuid() change_svgid() In each case, the call now acts on a credential not a process, and as such no longer requires more complicated process locking/etc. They now assume the caller will do any necessary allocation of an exclusive credential reference. Each is commented to document its reference requirements. o CANSIGIO() is simplified to require only credentials, not processes and pcreds. o Remove lots of (p_pcred==NULL) checks. o Add an XXX to authorization code in nfs_lock.c, since it's questionable, and needs to be considered carefully. o Simplify posix4 authorization code to require only credentials, not processes and pcreds. Note that this authorization, as well as CANSIGIO(), needs to be updated to use the p_cansignal() and p_cansched() centralized authorization routines, as they currently do not take into account some desirable restrictions that are handled by the centralized routines, as well as being inconsistent with other similar authorization instances. o Update libkvm to take these changes into account. Obtained from: TrustedBSD Project Reviewed by: green, bde, jhb, freebsd-arch, freebsd-audit
* Axe unneeded spl()'s.jhb2001-05-211-4/+1
|
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-191-0/+7
| | | | | | | | | | | | | | | | | | | vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-2/+2
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Revert consequences of changes to mount.h, part 2.grog2001-04-291-2/+0
| | | | Requested by: bde
* Correct #includes to work with fixed sys/mount.h.grog2001-04-231-0/+2
|
* Proc locking.jhb2001-03-071-3/+9
|
* Fix typo: seperate -> separate.asmodai2001-02-061-1/+1
| | | | Seperate does not exist in the english language.
* Protect proc.p_pptr and proc.p_children/p_sibling with thejake2000-12-231-0/+2
| | | | | | | | proctree_lock. linprocfs not locked pending response from informal maintainer. Reviewed by: jhb, -smp@
* o Add a comment to exec_check_permissions() to indicate that therwatson2000-11-301-0/+1
| | | | | | | | | | passed vnode must be locked; this is the case because of calls to VOP_GETATTR(), VOP_ACCESS(), and VOP_OPEN(). This becomes more of an issue when VOP_ACCESS() gets a bit more complicated, which it does when you introduce ACL, Capability, and MAC support. Obtained from: TrustedBSD Project
* Catch up to moving headers:jhb2000-10-201-1/+1
| | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
* Add a gross hack for ia64 to allocate the backing store for a new program.dfr2000-10-121-0/+16
|
* Make size of dynamic loader argument variable to supporttakawata2000-09-261-14/+22
| | | | | | various executable file format. Reviewed by: peter
* Remove unneeded #include that was a remnant of an earlier version oftruckman2000-09-211-1/+0
| | | | | | my uidinfo patch. Found by: phk
* Added used include of <sys/mutex.h> (don't depend on pollution inbde2000-09-171-0/+1
| | | | <sys/signalvar.h>).
* Add three new VOPs: VOP_CREATEVOBJECT, VOP_DESTROYVOBJECT and VOP_GETVOBJECT.bp2000-09-121-1/+1
| | | | | | | They will be used by nullfs and other stacked filesystems to support full cache coherency. Reviewed in general by: mckusick, dillon
* Remove uidinfo hash table lookup and maintenance out of chgproccnt() andtruckman2000-09-051-1/+2
| | | | | | | | | | | | | | chgsbsize(), which are called rather frequently and may be called from an interrupt context in the case of chgsbsize(). Instead, do the hash table lookup and maintenance when credentials are changed, which is a lot less frequent. Add pointers to the uidinfo structures to the ucred and pcred structures for fast access. Pass a pointer to the credential to chgproccnt() and chgsbsize() instead of passing the uid. Add a reference count to the uidinfo structure and use it to decide when to free the structure rather than freeing the structure when the resource consumption drops to zero. Move the resource tracking code from kern_proc.c to kern_resource.c. Move some duplicate code sequences in kern_prot.c to separate helper functions. Change KASSERTs in this code to unconditional tests and calls to panic().
* Support for unsigned integer and long sysctl variables. Update thejhb2000-07-051-5/+7
| | | | | | | | | SYSCTL_LONG macro to be consistent with other integer sysctl variables and require an initial value instead of assuming 0. Update several sysctl variables to use the unsigned types. PR: 15251 Submitted by: Kelly Yancey <kbyanc@posi.net>
* Remove unneeded #include <vm/vm_zone.h>phk2000-04-301-1/+0
| | | | Generated by: src/tools/tools/kerninclude
* Fix #! script exec under linux emulation. If a script is exec'd from adillon2000-04-261-27/+36
| | | | | | | | | | program running under linux emulation, the script binary is checked for in /compat/linux first. Without this patch the wrong script binary (i.e. the FreeBSD binary) will be run instead of the linux binary. For example, #!/bin/sh, thus breaking out of linux compatibility mode. This solves a number of problems people have had installing linux software on FreeBSD boxes.
* Remove unneeded <sys/buf.h> includes.phk2000-04-181-1/+0
| | | | | Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks by 924 bytes.
* Introduce kqueue() and kevent(), a kernel event notification facility.jlemon2000-04-161-0/+5
|
* When we are execing a setugid program, and we have a procfs filesystemimp2000-01-201-0/+1
| | | | | | | | file open in one of the special file descriptors (0, 1, or 2), close it before completing the exec. Submitted by: nergal@idea.avet.com.pl Constructive comments: deraadt@openbsd.org, sef, peter, jkh
* Changed the type used to represent the user stack pointer from `long *'bde1999-12-271-5/+5
| | | | | | | | to `register_t *'. This fixes bugs like misplacement of argc and argv on the user stack on i386's with 64-bit longs. We still use longs to represent "words" like argc and argv, and assume that they are on the stack (and that there is stack). The suword() and fuword() families should also use register_t.
* Introduce NDFREE (and remove VOP_ABORTOP)eivind1999-12-151-3/+3
|
* Add a sysctl to control if argv is disclosed to the world:phk1999-11-261-0/+3
| | | | | | | kern.ps_argsopen It defaults to 1 which means that all users can see all argvs in ps(1). Reviewed by: Warner
* Introduce commandline caching in the kernel.phk1999-11-161-0/+23
| | | | | | | | | | | This fixes some nasty procfs problems for SMP, makes ps(1) run much faster, and makes ps(1) even less dependent on /proc which will aid chroot and jails alike. To disable this facility and revert to previous behaviour: sysctl -w kern.ps_arg_cache_limit=0 For full details see the current@FreeBSD.org mail-archives.
* useracc() the prequel:phk1999-10-291-1/+0
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Stop profiling on exec.imp1999-08-111-1/+4
| | | | Obtained from: NetBSD
* Suser() simplification:phk1999-04-271-2/+2
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* unifdef -DVM_STACK - it's been on for a while for x86 and was checkedpeter1999-04-191-18/+1
| | | | and appeared to be working for the Alpha some time ago.
* Restore support for executing BSD/OS binaries on the i386 by passingjdp1999-04-031-3/+5
| | | | | | | | the address of the ps_strings structure to the process via %ebx. For other kinds of binaries, %ebx is still zeroed as before. Submitted by: Thomas Stephens <tas@stephens.org> Reviewed by: jdp
* Hide access to vmspace:vm_pmap with inline function vmspace_pmap(). Thisluoqi1999-02-191-2/+2
| | | | | | | is the preparation step for moving pmap storage out of vmspace proper. Reviewed by: Alan Cox <alc@cs.rice.edu> Matthew Dillion <dillon@apollo.backplane.com>
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-3/+3
| | | | kernel compile
OpenPOWER on IntegriCloud