summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
Commit message (Collapse)AuthorAgeFilesLines
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderPaul Saab2001-10-101-5/+5
| | | | | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks Notes: svn path=/head/; revision=84783
* Move setregs() out from under the PROC_LOCK so that it can use functionsDoug Rabson2001-10-101-4/+4
| | | | | | | list suword() which may trap. Notes: svn path=/head/; revision=84778
* proces -> process in a comment.John Baldwin2001-10-091-1/+1
| | | | Notes: svn path=/head/; revision=84729
* KSE Milestone 2Julian Elischer2001-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 Notes: svn path=/head/; revision=83366
* Pushdown Giant for acct(), kqueue(), kevent(), execve(), fork(),Matthew Dillon2001-09-011-5/+10
| | | | | | | vfork(), rfork(), jail(). Notes: svn path=/head/; revision=82710
* Fix a simple typo I just happened to find.Alexander Langer2001-08-221-1/+1
| | | | Notes: svn path=/head/; revision=82147
* Correct spelling in a comment and remove trailing newline from aDima Dorfman2001-07-111-2/+2
| | | | | | | panic() call (panic() adds it itself). Notes: svn path=/head/; revision=79569
* Don't share sig handlers after an execGuido van Rooij2001-07-091-1/+23
| | | | | | | Reviewed by: Alfred Perlstein Notes: svn path=/head/; revision=79480
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachMatthew Dillon2001-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. Notes: svn path=/head/; revision=79224
* Fix some lock order reversals where we called free() while holding a procJohn Baldwin2001-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. Notes: svn path=/head/; revision=78519
* Move setugid() a little sooner to before we release tracing in casePeter Wemm2001-06-161-2/+3
| | | | | | | crdup() or change_e*id() block on malloc() or mutex. Notes: svn path=/head/; revision=78371
* o pcred-removal changes included modifications to optimize the setting ofRobert Watson2001-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 Notes: svn path=/head/; revision=77242
* o Merge contents of struct pcred into struct ucred. Specifically, add theRobert Watson2001-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 Notes: svn path=/head/; revision=77183
* Axe unneeded spl()'s.John Baldwin2001-05-211-4/+1
| | | | Notes: svn path=/head/; revision=76939
* Introduce a global lock for the vm subsystem (vm_mtx).Alfred Perlstein2001-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 Notes: svn path=/head/; revision=76827
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-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) Notes: svn path=/head/; revision=76166
* Revert consequences of changes to mount.h, part 2.Greg Lehey2001-04-291-2/+0
| | | | | | | Requested by: bde Notes: svn path=/head/; revision=76117
* Correct #includes to work with fixed sys/mount.h.Greg Lehey2001-04-231-0/+2
| | | | Notes: svn path=/head/; revision=75858
* Proc locking.John Baldwin2001-03-071-3/+9
| | | | Notes: svn path=/head/; revision=73926
* Fix typo: seperate -> separate.Jeroen Ruigrok van der Werven2001-02-061-1/+1
| | | | | | | Seperate does not exist in the english language. Notes: svn path=/head/; revision=72091
* Protect proc.p_pptr and proc.p_children/p_sibling with theJake Burkholder2000-12-231-0/+2
| | | | | | | | | | | proctree_lock. linprocfs not locked pending response from informal maintainer. Reviewed by: jhb, -smp@ Notes: svn path=/head/; revision=70317
* o Add a comment to exec_check_permissions() to indicate that theRobert Watson2000-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 Notes: svn path=/head/; revision=69411
* Catch up to moving headers:John Baldwin2000-10-201-1/+1
| | | | | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h Notes: svn path=/head/; revision=67365
* Add a gross hack for ia64 to allocate the backing store for a new program.Doug Rabson2000-10-121-0/+16
| | | | Notes: svn path=/head/; revision=67015
* Make size of dynamic loader argument variable to supportTakanori Watanabe2000-09-261-14/+22
| | | | | | | | | various executable file format. Reviewed by: peter Notes: svn path=/head/; revision=66379
* Remove unneeded #include that was a remnant of an earlier version ofDon Lewis2000-09-211-1/+0
| | | | | | | | | my uidinfo patch. Found by: phk Notes: svn path=/head/; revision=66162
* Added used include of <sys/mutex.h> (don't depend on pollution inBruce Evans2000-09-171-0/+1
| | | | | | | <sys/signalvar.h>). Notes: svn path=/head/; revision=65980
* Add three new VOPs: VOP_CREATEVOBJECT, VOP_DESTROYVOBJECT and VOP_GETVOBJECT.Boris Popov2000-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 Notes: svn path=/head/; revision=65770
* Remove uidinfo hash table lookup and maintenance out of chgproccnt() andDon Lewis2000-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(). Notes: svn path=/head/; revision=65495
* Support for unsigned integer and long sysctl variables. Update theJohn Baldwin2000-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> Notes: svn path=/head/; revision=62622
* Remove unneeded #include <vm/vm_zone.h>Poul-Henning Kamp2000-04-301-1/+0
| | | | | | | Generated by: src/tools/tools/kerninclude Notes: svn path=/head/; revision=59794
* Fix #! script exec under linux emulation. If a script is exec'd from aMatthew Dillon2000-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. Notes: svn path=/head/; revision=59663
* Remove unneeded <sys/buf.h> includes.Poul-Henning Kamp2000-04-181-1/+0
| | | | | | | | Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks by 924 bytes. Notes: svn path=/head/; revision=59368
* Introduce kqueue() and kevent(), a kernel event notification facility.Jonathan Lemon2000-04-161-0/+5
| | | | Notes: svn path=/head/; revision=59288
* When we are execing a setugid program, and we have a procfs filesystemWarner Losh2000-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 Notes: svn path=/head/; revision=56313
* Changed the type used to represent the user stack pointer from `long *'Bruce Evans1999-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. Notes: svn path=/head/; revision=55141
* Introduce NDFREE (and remove VOP_ABORTOP)Eivind Eklund1999-12-151-3/+3
| | | | Notes: svn path=/head/; revision=54655
* Add a sysctl to control if argv is disclosed to the world:Poul-Henning Kamp1999-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 Notes: svn path=/head/; revision=53709
* Introduce commandline caching in the kernel.Poul-Henning Kamp1999-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. Notes: svn path=/head/; revision=53239
* useracc() the prequel:Poul-Henning Kamp1999-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. Notes: svn path=/head/; revision=52635
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Stop profiling on exec.Warner Losh1999-08-111-1/+4
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=49636
* Suser() simplification:Poul-Henning Kamp1999-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. Notes: svn path=/head/; revision=46112
* unifdef -DVM_STACK - it's been on for a while for x86 and was checkedPeter Wemm1999-04-191-18/+1
| | | | | | | and appeared to be working for the Alpha some time ago. Notes: svn path=/head/; revision=45821
* Restore support for executing BSD/OS binaries on the i386 by passingJohn Polstra1999-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 Notes: svn path=/head/; revision=45270
* Hide access to vmspace:vm_pmap with inline function vmspace_pmap(). ThisLuoqi Chen1999-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> Notes: svn path=/head/; revision=44146
* Fix warnings in preparation for adding -Wall -Wcast-qual to theMatthew Dillon1999-01-281-3/+3
| | | | | | | kernel compile Notes: svn path=/head/; revision=43311
* Fix warnings in preparation for adding -Wall -Wcast-qual to theMatthew Dillon1999-01-271-2/+2
| | | | | | | kernel compile Notes: svn path=/head/; revision=43301
* Add (but don't activate) code for a special VM option to makeJulian Elischer1999-01-061-1/+19
| | | | | | | | | | | | | | | | downward growing stacks more general. Add (but don't activate) code to use the new stack facility when running threads, (specifically the linux threads support). This allows people to use both linux compiled linuxthreads, and also the native FreeBSD linux-threads port. The code is conditional on VM_STACK. Not using this will produce the old heavily tested system. Submitted by: Richard Seaman <dick@tar.com> Notes: svn path=/head/; revision=42360
* Various changes to support OSF1 emulation:Doug Rabson1998-12-301-5/+6
| | | | | | | | | | | | | | * Move the user stack from VM_MAXUSER_ADDRESS to a place below the 32bit boundary (needed to support 32bit OSF programs). This should also save one pagetable per process. * Add cvtqlsv to the set of instructions handled by the floating point software completion code. * Disable all floating point exceptions by default. * A minor change to execve to allow the OSF1 image activator to support dynamic loading. Notes: svn path=/head/; revision=42175