summaryrefslogtreecommitdiff
path: root/sys/kern/sysv_shm.c
Commit message (Collapse)AuthorAgeFilesLines
* Lock the vm object when performing back-to-back vm_object_clear_flag() andAlan Cox2003-01-021-0/+2
| | | | | | | vm_object_set_flag(). Notes: svn path=/head/; revision=108556
* return foo -> return (foo)Alfred Perlstein2002-08-151-22/+22
| | | | Notes: svn path=/head/; revision=101891
* Change struct vmspace->vm_shm from void * to struct shmmap_state *, thisAlfred Perlstein2002-07-221-3/+3
| | | | | | | removes the need for casts in several cases. Notes: svn path=/head/; revision=100512
* Remove caddr_t.Alfred Perlstein2002-07-221-12/+12
| | | | Notes: svn path=/head/; revision=100511
* Remove __P.Alfred Perlstein2002-03-191-17/+17
| | | | Notes: svn path=/head/; revision=92723
* - Use td_ucred for jail checks.John Baldwin2002-03-051-29/+14
| | | | | | | | | | | - Move jail checks and some other checks involving constants and stack variables out from under Giant. This isn't perfectly safe atm because jail_sysvipc_allowed is read w/o a lock meaning that its value could be stale. This global variable will soon become a per-jail flag, however, at which time it will either not need a lock or will use the prison lock. Notes: svn path=/head/; revision=91703
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-1/+1
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* Make AIO a loadable module.Alfred Perlstein2001-12-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the explicit call to aio_proc_rundown() from exit1(), instead AIO will use at_exit(9). Add functions at_exec(9), rm_at_exec(9) which function nearly the same as at_exec(9) and rm_at_exec(9), these functions are called on behalf of modules at the time of execve(2) after the image activator has run. Use a modified version of tegge's suggestion via at_exec(9) to close an exploitable race in AIO. Fix SYSCALL_MODULE_HELPER such that it's archetecuterally neutral, the problem was that one had to pass it a paramater indicating the number of arguments which were actually the number of "int". Fix it by using an inline version of the AS macro against the syscall arguments. (AS should be available globally but we'll get to that later.) Add a primative system for dynamically adding kqueue ops, it's really not as sophisticated as it should be, but I'll discuss with jlemon when he's around. Notes: svn path=/head/; revision=88633
* Introduce [IPC|SHM]_[INFO|STAT] to shmctl to makeMichael Reifenberger2001-10-281-1/+44
| | | | | | | `/compat/linux/usr/bin/ipcs -m` happy. Notes: svn path=/head/; revision=85623
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderPaul Saab2001-10-101-2/+1
| | | | | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks Notes: svn path=/head/; revision=84783
* PR: kern/29698 (part)Michael Reifenberger2001-09-131-0/+7
| | | | | | | | | | Reviewed by: audit Add tunables for the sem* and shm* syscontrols for tuning on boottime until they become dynamic. SAP R/3 doesn't like the compiled in defaults. Notes: svn path=/head/; revision=83413
* KSE Milestone 2Julian Elischer2001-09-121-51/+41
| | | | | | | | | | | | | | | | | 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
* Giant Pushdown: sysv shm, sem, and msg calls.Matthew Dillon2001-08-311-59/+137
| | | | Notes: svn path=/head/; revision=82607
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachMatthew Dillon2001-07-041-13/+11
| | | | | | | | | | | | (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
* Export via sysctl:Dima Dorfman2001-05-301-0/+10
| | | | | | | | | | | | | | * all members of msginfo from sysv_msg.c; * msqids from sysv_msg.c; * sema from sysv_sem.c; and * shmsegs from sysv_shm.c; These will be used by ipcs(1) in non-kvm mode. Reviewed by: tmm Notes: svn path=/head/; revision=77461
* Correct style bugs with regards to long lines and comments.Dima Dorfman2001-05-231-15/+22
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=77104
* Correct the vm_mtx handling; specifically, don't acquire it inDima Dorfman2001-05-221-5/+13
| | | | | | | | | | | shm_deallocate_segment because shmexit_myhook calls it, and the latter should always be called with it already held. Submitted by: dwmalone, dd Approved by: alfred Notes: svn path=/head/; revision=76972
* Sort includes.John Baldwin2001-05-211-1/+1
| | | | Notes: svn path=/head/; revision=76941
* Aquire vm mutex when releasing sysv shm segments.Alfred Perlstein2001-05-201-0/+4
| | | | | | | Obtained from: Dima Dorfman <dima@unixfreak.org> Notes: svn path=/head/; revision=76908
* Introduce a global lock for the vm subsystem (vm_mtx).Alfred Perlstein2001-05-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | 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
* Raise the SysV shared memory defaults to more reasonable values.Matthew Dillon2001-05-041-3/+3
| | | | | | | | | Mainly increases the shared memory limit from 4M to 32M (approx). Many more programs these days use SysV shared memory, especially X-related programs. Notes: svn path=/head/; revision=76275
* 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
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectRobert Watson2001-02-211-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=72786
* It is _DEFINITELY_ not okay to change shmseg on a running system.Brian Feldman2001-02-041-1/+1
| | | | Notes: svn path=/head/; revision=72019
* Use predictable internal names for the sysvipc modules, so we have aDag-Erling Smørgrav2001-01-141-3/+4
| | | | | | | chance of getting dependencies working. Notes: svn path=/head/; revision=71038
* sysvipc loadable.Alfred Perlstein2000-12-011-8/+62
| | | | | | | | | new syscall entry lkmressys - "reserved loadable syscall" Make syscall_register allow overwriting of such entries (lkmressys). Notes: svn path=/head/; revision=69449
* o Deny access to System V IPC from within jail by default, as in theRobert Watson2000-10-311-0/+19
| | | | | | | | | | | | | | | current implementation, jail neither virtualizes the Sys V IPC namespace, nor provides inter-jail protections on IPC objects. o Support for System V IPC can be enabled by setting jail.sysvipc_allowed=1 using sysctl. o This is not the "real fix" which involves virtualizing the System V IPC namespace, but prevents processes within jail from influencing those outside of jail when not approved by the administrator. Reported by: Paulo Fragoso <paulo@nlink.com.br> Notes: svn path=/head/; revision=68024
* This is a cleanup patch to Peter's new OBJT_PHYS VM object typeMatthew Dillon2000-05-291-7/+10
| | | | | | | | | | | | | | | | | | | | and sysv shared memory support for it. It implements a new PG_UNMANAGED flag that has slightly different characteristics from PG_FICTICIOUS. A new sysctl, kern.ipc.shm_use_phys has been added to enable the use of physically-backed sysv shared memory rather then swap-backed. Physically backed shm segments are not tracked with PV entries, allowing programs which use a large shm segment as a rendezvous point to operate without eating an insane amount of KVM in the PV entry management. Read: Oracle. Peter's OBJT_PHYS object will also allow us to eventually implement page-table sharing and/or 4MB physical page support for such segments. We're half way there. Notes: svn path=/head/; revision=61081
* Provide a temporary undocumented option: SHM_PHYS_BACKED. This willPeter Wemm2000-05-211-0/+5
| | | | | | | | become sysctl and/or flags controlled later. It's mainly here for an easy place to test the physical memory backed objects. Notes: svn path=/head/; revision=60758
* Make sysv-style shared memory tuneable params fully runtime adjustablePeter Wemm2000-03-301-23/+81
| | | | | | | | | | | via sysctl. It's done pretty simply but it should be quite adequate. Also move SHMMAXPGS from $machine/include/vmparam.h as the comments that went with it were wrong... we don't allocate KVM space for the pages so that comment is bogus.. The only practical limit is how much physical ram you want to lock up as this stuff isn't paged out or swap backed. Notes: svn path=/head/; revision=58820
* shmat: If VM_PROT_READ_IS_EXEC is defined and prot includes VM_PROT_READ,Alan Cox2000-03-101-0/+4
| | | | | | | | | | | | | | VM_PROT_EXECUTE must be added to prot before calling vm_map_find. Without this change, an mprotect on a shmat'ed region fails (when it shouldn't). This bug was reported Feb 28 by Brooks Davis <brooks@one-eyed-alien.net> on -hackers. Reviewed by: bde Approved by: jkh Notes: svn path=/head/; revision=57884
* useracc() the prequel:Poul-Henning Kamp1999-10-291-2/+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
* For consistency with other implementations, check for the existenceAlan Cox1999-06-191-3/+3
| | | | | | | | | | of the segment before checking its permissions. PR: kern/11999 Submitted by: Brooks Davis <brooks@one-eyed-alien.net> Notes: svn path=/head/; revision=48039
* Change suser_xxx() to suser() where it applies.Poul-Henning Kamp1999-04-271-11/+7
| | | | Notes: svn path=/head/; revision=46116
* This is a rather large commit that encompasses the new swapper,Matthew Dillon1999-01-211-1/+2
| | | | | | | | | | | | | changes to the VM system to support the new swapper, VM bug fixes, several VM optimizations, and some additional revamping of the VM code. The specific bug fixes will be documented with additional forced commits. This commit is somewhat rough in regards to code cleanup issues. Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com> Notes: svn path=/head/; revision=42957
* Fixed two potentially serious classes of bugs:David Greenman1998-10-131-4/+3
| | | | | | | | | | | | | | | | | | | 1) The vnode pager wasn't properly tracking the file size due to "size" being page rounded in some cases and not in others. This sometimes resulted in corrupted files. First noticed by Terry Lambert. Fixed by changing the "size" pager_alloc parameter to be a 64bit byte value (as opposed to a 32bit page index) and changing the pagers and their callers to deal with this properly. 2) Fixed a bogus type cast in round_page() and trunc_page() that caused some 64bit offsets and sizes to be scrambled. Removing the cast required adding casts at a few dozen callers. There may be problems with other bogus casts in close-by macros. A quick check seemed to indicate that those were okay, however. Notes: svn path=/head/; revision=40286
* Change various syscalls to use size_t arguments instead of u_int.Doug Rabson1998-08-241-3/+3
| | | | | | | | | | | | | 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
* Fix the shm panic. I mistakenly used the shadow_count to keep the objectJohn Dyson1998-05-041-3/+2
| | | | | | | from being split, and instead added an OBJ_NOSPLIT. Notes: svn path=/head/; revision=35694
* Work around some VM bugs, the worst being an overly aggressiveJohn Dyson1998-05-041-1/+5
| | | | | | | | swap space free calculation. More complete fixes will be forthcoming, in a week. Notes: svn path=/head/; revision=35669
* Eradicate the variable "time" from the kernel, using various measures.Poul-Henning Kamp1998-03-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde Notes: svn path=/head/; revision=34961
* Staticize.Eivind Eklund1998-02-091-2/+2
| | | | Notes: svn path=/head/; revision=33181
* Make COMPAT_43 and COMPAT_SUNOS new-style options.Eivind Eklund1997-12-161-1/+2
| | | | Notes: svn path=/head/; revision=31778
* Move the "retval" (3rd) parameter from all syscall functions and putPoul-Henning Kamp1997-11-061-31/+23
| | | | | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled. Notes: svn path=/head/; revision=30994
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.Poul-Henning Kamp1997-10-121-2/+2
| | | | | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde Notes: svn path=/head/; revision=30354
* Distribute and statizice a lot of the malloc M_* types.Poul-Henning Kamp1997-10-111-1/+3
| | | | | | | Substantial input from: bde Notes: svn path=/head/; revision=30309
* Removed unused #includes.Bruce Evans1997-08-021-4/+1
| | | | Notes: svn path=/head/; revision=27845
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* This is the kernel Lite/2 commit. There are some requisite userlandJohn Dyson1997-02-101-1/+1
| | | | | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org> Notes: svn path=/head/; revision=22521
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673