summaryrefslogtreecommitdiffstats
path: root/sys/kern/sysv_shm.c
Commit message (Collapse)AuthorAgeFilesLines
* Correct a reference counting bug in shmat(2). If vm_map_find(9)nectar2004-02-051-0/+1
| | | | | | | | failed, the reference count for the virtual memory object referenced by the specified shared memory segment would have been erroneously incremented. Reported by: Joost Pol <joost@pine.nl>
* Slight whitespace consistency improvement:rwatson2003-11-071-1/+1
| | | | | Trim trailing whitespace. Remove unmatched " " before ")".
* Back out the following revisions:fjoe2003-11-051-18/+21
| | | | | | | | | | | | | | | | | | 1.36 +73 -60 src/sys/compat/linux/linux_ipc.c 1.83 +102 -48 src/sys/kern/sysv_shm.c 1.8 +4 -0 src/sys/sys/syscallsubr.h That change was intended to support vmware3, but wantrem parameter is useless because vmware3 uses SYSV shared memory to talk with X server and X server is native application. The patch worked because check for wantrem was not valid (wantrem and SHMSEG_REMOVED was never checked for SHMSEG_ALLOCATED segments). Add kern.ipc.shm_allow_removed (integer, rw) sysctl (default 0) which when set to 1 allows to return removed segments in shm_find_segment_by_shmid() and shm_find_segment_by_shmidx(). MFC after: 1 week
* Change all SYSCTLS which are readonly and have a related TUNABLEsilby2003-10-211-2/+2
| | | | | from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide more useful error messages.
* Update some argument-documenting comments to match reality.nectar2003-08-071-2/+3
| | | | | Add an explicit range check to those same arguments to reduce risk of cardiac arrest in future code readers.
* Consistently use the BSD u_int and u_short instead of the SYSV uint andjhb2003-08-071-2/+2
| | | | | | | ushort. In most of these files, there was a mixture of both styles and this change just makes them self-consistent. Requested by: bde (kern_ktrace.c)
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Change the semantics of sysv shm emulation to take a additionalmbr2003-05-051-48/+102
| | | | | | | | | | | | | | | | | argument to the functions shm{at,ctl}1 and shm_find_segment_by_shmid{x}. The BSD semantics didn't allow the usage of shared segment after being marked for removal through IPC_RMID. The patch involves the following functions: - shmat - shmctl - shm_find_segment_by_shmid - shm_find_segment_by_shmidx - linux_shmat - linux_shmctl Submitted by: Orlando Bassotto <orlando.bassotto@ieo-research.it> Reviewed by: marcel
* Lock some manipulations of the vm object's flags.alc2003-04-131-2/+2
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-5/+5
| | | | Approved by: trb
* Fix logic in loop so it actually executes.alfred2003-02-161-1/+1
| | | | Pointed out by: fjoe
* prevent overflow in shminfo.shmmaxalfred2003-02-161-1/+5
|
* Bring shm functions closer the the opengroup standards.alfred2003-01-251-2/+2
| | | | | PR: 47469 Submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-5/+5
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* It is possible for an active aio to prevent shared memory from beingdillon2003-01-131-17/+15
| | | | | | | | | | | | | dereferenced when a process exits due to the vmspace ref-count being bumped. Change shmexit() and shmexit_myhook() to take a vmspace instead of a process and call it in vmspace_dofree(). This way if it is missed in exit1()'s early-resource-free it will still be caught when the zombie is reaped. Also fix a potential race in shmexit_myhook() by NULLing out vmspace->vm_shm prior to calling shm_delete_mapping() and free(). MFC after: 7 days
* Lock the vm object when performing back-to-back vm_object_clear_flag() andalc2003-01-021-0/+2
| | | | vm_object_set_flag().
* return foo -> return (foo)alfred2002-08-151-22/+22
|
* Change struct vmspace->vm_shm from void * to struct shmmap_state *, thisalfred2002-07-221-3/+3
| | | | removes the need for casts in several cases.
* Remove caddr_t.alfred2002-07-221-12/+12
|
* Remove __P.alfred2002-03-191-17/+17
|
* - Use td_ucred for jail checks.jhb2002-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.
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-1/+1
| | | | reference.
* Make AIO a loadable module.alfred2001-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.
* Introduce [IPC|SHM]_[INFO|STAT] to shmctl to makemr2001-10-281-1/+44
| | | | `/compat/linux/usr/bin/ipcs -m` happy.
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderps2001-10-101-2/+1
| | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks
* PR: kern/29698 (part)mr2001-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.
* KSE Milestone 2julian2001-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
* Giant Pushdown: sysv shm, sem, and msg calls.dillon2001-08-311-59/+137
|
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-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.
* Export via sysctl:dd2001-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
* Correct style bugs with regards to long lines and comments.dd2001-05-231-15/+22
| | | | Reviewed by: bde
* Correct the vm_mtx handling; specifically, don't acquire it indd2001-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
* Sort includes.jhb2001-05-211-1/+1
|
* Aquire vm mutex when releasing sysv shm segments.alfred2001-05-201-0/+4
| | | | Obtained from: Dima Dorfman <dima@unixfreak.org>
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-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
* Raise the SysV shared memory defaults to more reasonable values.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.
* 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)
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectrwatson2001-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
* It is _DEFINITELY_ not okay to change shmseg on a running system.green2001-02-041-1/+1
|
* Use predictable internal names for the sysvipc modules, so we have ades2001-01-141-3/+4
| | | | chance of getting dependencies working.
* sysvipc loadable.alfred2000-12-011-8/+62
| | | | | | new syscall entry lkmressys - "reserved loadable syscall" Make syscall_register allow overwriting of such entries (lkmressys).
* o Deny access to System V IPC from within jail by default, as in therwatson2000-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>
* This is a cleanup patch to Peter's new OBJT_PHYS VM object typedillon2000-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.
* Provide a temporary undocumented option: SHM_PHYS_BACKED. This willpeter2000-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.
* Make sysv-style shared memory tuneable params fully runtime adjustablepeter2000-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.
* shmat: If VM_PROT_READ_IS_EXEC is defined and prot includes VM_PROT_READ,alc2000-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
* useracc() the prequel:phk1999-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.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* For consistency with other implementations, check for the existencealc1999-06-191-3/+3
| | | | | | | of the segment before checking its permissions. PR: kern/11999 Submitted by: Brooks Davis <brooks@one-eyed-alien.net>
* Change suser_xxx() to suser() where it applies.phk1999-04-271-11/+7
|
OpenPOWER on IntegriCloud