summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fix some 64bit truncation problems which crept into SYSCTL_LONG() with theDoug Rabson1998-12-271-3/+6
| | | | | | | | | | | last cleanup. Since the oid_arg2 field of struct sysctl_oid is not wide enough to hold a long, the SYSCTL_LONG() macro has been modified to only support exporting long variables by pointer instead of by value. Reviewed by: bde Notes: svn path=/head/; revision=42095
* Removed the cast to a pointer in the definition of PS_STRINGS andBruce Evans1998-12-161-4/+3
| | | | | | | | | | adjusted related casts to match (only in the kernel in this commit). The pointer was only wanted in one place in kern_exec.c. Applications should use the kern.ps_strings sysctl instead of PS_STRINGS, so they shouldn't notice this change. Notes: svn path=/head/; revision=41871
* Removed all traces of SYSCTL_INTPTR(). Pointers can't really be passedBruce Evans1998-12-161-5/+4
| | | | | | | | | | | | across the kernel -> application interface, and for the one sysctl where they were passed and actually used (kern.ps_strings), the applications want addresses represented as u_longs anyway (the other sysctl that passed them, kern.usrstack, has never been used). Agreed to by: dfr, phk Notes: svn path=/head/; revision=41870
* Added a second argument, "activate" to the vm_page_unwire() call so thatDavid Greenman1998-10-281-2/+2
| | | | | | | the caller can select either inactive or active queue to put the page on. Notes: svn path=/head/; revision=40700
* *gulp*. Jordan specifically OK'ed this..Peter Wemm1998-10-161-5/+66
| | | | | | | | | | | This is the bulk of the support for doing kld modules. Two linker_sets were replaced by SYSINIT()'s. VFS's and exec handlers are self registered. kld is now a superset of lkm. I have converted most of them, they will follow as a seperate commit as samples. This all still works as a static a.out kernel using LKM's. Notes: svn path=/head/; revision=40435
* Cosmetic changes to the PAGE_XXX macros to make them consistent withDoug Rabson1998-09-041-3/+3
| | | | | | | the other objects in vm. Notes: svn path=/head/; revision=38799
* Change various syscalls to use size_t arguments instead of u_int.Doug Rabson1998-08-241-9/+4
| | | | | | | | | | | | | Add some overflow checks to read/write (from bde). Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags and vm_object::paging_in_progress to use operations which are not interruptable. Reviewed by: Bruce Evans <bde@zeta.org.au> Notes: svn path=/head/; revision=38517
* Cast between longs and pointers via intptr_t. The results of fuword()Bruce Evans1998-07-151-9/+9
| | | | | | | | should be checked before casting. The results of suword() should be checked. Notes: svn path=/head/; revision=37662
* This commit fixes various 64bit portability problems required forDoug Rabson1998-06-071-13/+16
| | | | | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time. Notes: svn path=/head/; revision=36735
* Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.Dag-Erling Smørgrav1998-04-171-2/+2
| | | | Notes: svn path=/head/; revision=35256
* Free the first page also if it is not valid.John Dyson1998-03-081-2/+2
| | | | Notes: svn path=/head/; revision=34234
* This mega-commit is meant to fix numerous interrelated problems. ThereJohn Dyson1998-03-071-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | has been some bitrot and incorrect assumptions in the vfs_bio code. These problems have manifest themselves worse on NFS type filesystems, but can still affect local filesystems under certain circumstances. Most of the problems have involved mmap consistancy, and as a side-effect broke the vfs.ioopt code. This code might have been committed seperately, but almost everything is interrelated. 1) Allow (pmap_object_init_pt) prefaulting of buffer-busy pages that are fully valid. 2) Rather than deactivating erroneously read initial (header) pages in kern_exec, we now free them. 3) Fix the rundown of non-VMIO buffers that are in an inconsistent (missing vp) state. 4) Fix the disassociation of pages from buffers in brelse. The previous code had rotted and was faulty in a couple of important circumstances. 5) Remove a gratuitious buffer wakeup in vfs_vmio_release. 6) Remove a crufty and currently unused cluster mechanism for VBLK files in vfs_bio_awrite. When the code is functional, I'll add back a cleaner version. 7) The page busy count wakeups assocated with the buffer cache usage were incorrectly cleaned up in a previous commit by me. Revert to the original, correct version, but with a cleaner implementation. 8) The cluster read code now tries to keep data associated with buffers more aggressively (without breaking the heuristics) when it is presumed that the read data (buffers) will be soon needed. 9) Change to filesystem lockmgr locks so that they use LK_NOPAUSE. The delay loop waiting is not useful for filesystem locks, due to the length of the time intervals. 10) Correct and clean-up spec_getpages. 11) Implement a fully functional nfs_getpages, nfs_putpages. 12) Fix nfs_write so that modifications are coherent with the NFS data on the server disk (at least as well as NFS seems to allow.) 13) Properly support MS_INVALIDATE on NFS. 14) Properly pass down MS_INVALIDATE to lower levels of the VM code from vm_map_clean. 15) Better support the notion of pages being busy but valid, so that fewer in-transit waits occur. (use p->busy more for pageouts instead of PG_BUSY.) Since the page is fully valid, it is still usable for reads. 16) It is possible (in error) for cached pages to be busy. Make the page allocation code handle that case correctly. (It should probably be a printf or panic, but I want the system to handle coding errors robustly. I'll probably add a printf.) 17) Correct the design and usage of vm_page_sleep. It didn't handle consistancy problems very well, so make the design a little less lofty. After vm_page_sleep, if it ever blocked, it is still important to relookup the page (if the object generation count changed), and verify it's status (always.) 18) In vm_pageout.c, vm_pageout_clean had rotted, so clean that up. 19) Push the page busy for writes and VM_PROT_READ into vm_pageout_flush. 20) Fix vm_pager_put_pages and it's descendents to support an int flag instead of a boolean, so that we can pass down the invalidate bit. Notes: svn path=/head/; revision=34206
* Update the ELF image activator to use some of the exec resources ratherPeter Wemm1998-03-021-7/+2
| | | | | | | | | | | | | | | than rolling it's own. This means that it now uses the "safe" exec_map_first_page() to get the ld.so headers rather than risking a panic on a page fault failure (eg: NFS server goes down). Since all the ELF tools go to a lot of trouble to make sure everything lives in the first page for executables, this is a win. I have not seen any ELF executable on any system where all the headers didn't fit in the first page with lots of room to spare. I have been running variations of this code for some time on my pure ELF systems. Notes: svn path=/head/; revision=33983
* Removed unused #includes.Bruce Evans1998-02-251-3/+1
| | | | Notes: svn path=/head/; revision=33834
* Back out DIAGNOSTIC changes.Eivind Eklund1998-02-061-3/+1
| | | | Notes: svn path=/head/; revision=33134
* 1) Start using a cleaner and more consistant page allocator insteadJohn Dyson1998-02-051-27/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | of the various ad-hoc schemes. 2) When bringing in UPAGES, the pmap code needs to do another vm_page_lookup. 3) When appropriate, set the PG_A or PG_M bits a-priori to both avoid some processor errata, and to minimize redundant processor updating of page tables. 4) Modify pmap_protect so that it can only remove permissions (as it originally supported.) The additional capability is not needed. 5) Streamline read-only to read-write page mappings. 6) For pmap_copy_page, don't enable write mapping for source page. 7) Correct and clean-up pmap_incore. 8) Cluster initial kern_exec pagin. 9) Removal of some minor lint from kern_malloc. 10) Correct some ioopt code. 11) Remove some dead code from the MI swapout routine. 12) Correct vm_object_deallocate (to remove backing_object ref.) 13) Fix dead object handling, that had problems under heavy memory load. 14) Add minor vm_page_lookup improvements. 15) Some pages are not in objects, and make sure that the vm_page.c can properly support such pages. 16) Add some more page deficit handling. 17) Some minor code readability improvements. Notes: svn path=/head/; revision=33109
* Turn DIAGNOSTIC into a new-style option.Eivind Eklund1998-02-041-1/+3
| | | | Notes: svn path=/head/; revision=33108
* Implement the first page access for object type determination moreJohn Dyson1998-01-111-62/+94
| | | | | | | | VM clean. Also, use vm_map_insert instead of vm_mmap. Reviewed by: dg@freebsd.org Notes: svn path=/head/; revision=32446