aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sysv_sem.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-7/+7
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Don't leak memory in semop(2). (Fix a bug I introduced in rev 1.55.)Alfred Perlstein2002-10-191-1/+2
| | | | | | | Detective work by: jake Notes: svn path=/head/; revision=105429
* Make SYSVSEM mpsafe. Each semaphore set gets its own lock, howeverAlfred Perlstein2002-08-131-87/+172
| | | | | | | | | | | | | | | | | | there is a global lock over the undo structures because of the way they are managed. Switch to using SLIST instead of rolling our own linked list. Fix several races where a permission check was done before a copyin/copyout, if the copy happened to fault it may have been possible to race for access to a semaphore set that one shouldn't have access to. Requested by: rwatson Tested by: NetBSD regression suite. Notes: svn path=/head/; revision=101774
* Cleanup:Alfred Perlstein2002-08-051-28/+24
| | | | | | | | | Fix line wrapping. Remove 'register'. malloc(9) with M_WAITOK can't fail, so remove checks for that. Notes: svn path=/head/; revision=101350
* Cleanup:Alfred Perlstein2002-07-221-101/+51
| | | | | | | | Define a debug printf macro rather than wrapping all calls to printf with #ifdefs. Notes: svn path=/head/; revision=100523
* Remove caddr_t.Alfred Perlstein2002-07-221-14/+11
| | | | Notes: svn path=/head/; revision=100511
* Remove __P.Alfred Perlstein2002-03-191-12/+12
| | | | Notes: svn path=/head/; revision=92723
* Pacify gcc-3.1+, initialize two variables to avoid -WuninitializedPeter Wemm2002-03-191-2/+2
| | | | | | | warnings. Notes: svn path=/head/; revision=92665
* Fix a typo, unbreak the world.Maxim Konovalov2002-03-061-1/+1
| | | | | | | | Thanks to: mux Approved by: ru Notes: svn path=/head/; revision=91744
* Maximum semid is seminfo.semmni not seminfo.semmsl.Maxim Konovalov2002-03-061-3/+3
| | | | | | | | | | | PR: kern/34979 Submitted by: James Gritton <jamie@gritton.org> Reviewed by: alfred, ru Approved by: ru MFC after: 1 week Notes: svn path=/head/; revision=91736
* - Use td_ucred for jail checks.John Baldwin2002-03-051-25/+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
* Fix Giant leakage in several error cases in __semctl().John Baldwin2002-02-271-4/+4
| | | | Notes: svn path=/head/; revision=91417
* 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
* Rehash of 1.43: simply remove the comment, since it's highly redundantRobert Watson2002-02-181-13/+0
| | | | | | | and only partially correct. Notes: svn path=/head/; revision=90857
* style(9) prefers formatted comments in '/*' ... '*/' as opposed toRobert Watson2002-02-181-12/+12
| | | | | | | #if 0'd. Notes: svn path=/head/; revision=90817
* Eliminate semexit_hook using at_exit(9) and rm_at_exit(9).Alan Cox2001-12-301-2/+2
| | | | | | | Reviewed by: alfred Notes: svn path=/head/; revision=88715
* Make AIO a loadable module.Alfred Perlstein2001-12-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix SysV Semaphore Handling.Michael Reifenberger2001-10-111-38/+73
| | | | | | | | | | | Updated by peter following KSE and Giant pushdown. I've running with this patch for two week with no ill side effects. PR: kern/12014: Fix SysV Semaphore handling Submitted by: Peter Jeremy <peter.jeremy@alcatel.com.au> Notes: svn path=/head/; revision=84789
* PR: kern/29698 (part)Michael Reifenberger2001-09-131-0/+19
| | | | | | | | | Reviewed by: audit Implement SEM_STAT (like IPC_STAT but treats semid as sema-index). The linuxerator will need it. Notes: svn path=/head/; revision=83414
* PR: kern/29698 (part)Michael Reifenberger2001-09-131-0/+11
| | | | | | | | | | 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-49/+45
| | | | | | | | | | | | | | | | | 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
* Correct a debugging message.Dima Dorfman2001-09-111-1/+1
| | | | Notes: svn path=/head/; revision=83341
* Make the `nsops' variable in `semop' unsigned. This prevents anDima Dorfman2001-09-101-5/+5
| | | | | | | | | | | | | overflow if uap->nsops (which is already unsigned) is over INT_MAX; consequently, the bounds check below becomes valid. Previously, if a value over INT_MAX was passed in uap->nsops, the bounds check wouldn't catch it, and the value would be used to compute copyin()'s third argument. Obtained from: NetBSD Notes: svn path=/head/; revision=83292
* Giant Pushdown: sysv shm, sem, and msg calls.Matthew Dillon2001-08-311-109/+186
| | | | Notes: svn path=/head/; revision=82607
* Export via sysctl:Dima Dorfman2001-05-301-0/+11
| | | | | | | | | | | | | | * 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
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectRobert Watson2001-02-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-6/+58
| | | | | | | | | 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/+13
| | | | | | | | | | | | | | | 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
* Convert all users of fldoff() to offsetof(). fldoff() is badPoul-Henning Kamp2000-10-271-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | because it only takes a struct tag which makes it impossible to use unions, typedefs etc. Define __offsetof() in <machine/ansi.h> Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h> Remove myriad of local offsetof() definitions. Remove includes of <stddef.h> in kernel code. NB: Kernelcode should *never* include from /usr/include ! Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API. Deprecate <struct.h> with a warning. The warning turns into an error on 01-12-2000 and the file gets removed entirely on 01-01-2001. Paritials reviews by: various. Significant brucifications by: bde Notes: svn path=/head/; revision=67708
* Move the MSG* and SEM* options to opt_sysvipc.hPeter Wemm2000-05-011-14/+129
| | | | | | | | | | | | | | | | | | Remove evil allocation macros from machdep.c (why was that there???) and use malloc() instead. Move paramters out of param.h and into the code itself. Move a bunch of internal definitions from public sys/*.h headers (without #ifdef _KERNEL even) into the code itself. I had hoped to make some of this more dynamic, but the cost of doing wakeups on all sleeping processes on old arrays was too frightening. The other possibility is to initialize on the first use, and allow dynamic sysctl changes to parameters right until that point. That would allow /etc/rc.sysctl to change SEM* and MSG* defaults as we presently do with SHM*, but without the nightmare of changing a running system. Notes: svn path=/head/; revision=59839
* Remove the undocumented, flawed, broken-as-designed semconfig() syscall.Peter Wemm2000-05-011-79/+2
| | | | Notes: svn path=/head/; revision=59828
* Remove #ifdef for sem_wakeup() - we just use wakeup().Peter Wemm2000-03-301-10/+2
| | | | Notes: svn path=/head/; revision=58831
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Change suser_xxx() to suser() where it applies.Poul-Henning Kamp1999-04-271-14/+13
| | | | Notes: svn path=/head/; revision=46116
* Fixed problems with kernel config file overrides of sysv semaphoreMatthew Dillon1998-12-141-2/+2
| | | | | | | | | | parameters. Prior to this fix a kernel config override would effect only some of the kernel files, resulting in panics. PR: kern/9068 Notes: svn path=/head/; revision=41774
* Eradicate the variable "time" from the kernel, using various measures.Poul-Henning Kamp1998-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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
* Move the "retval" (3rd) parameter from all syscall functions and putPoul-Henning Kamp1997-11-061-21/+15
| | | | | | | | | | | | | | | 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
* Removed unused #includes.Bruce Evans1997-08-021-3/+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
* 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
* Clean up -Wunused warnings.Gary Palmer1996-06-121-2/+1
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=16322
* Somehow managed to miss these four files when converting the SYSV IPCGarrett Wollman1996-01-051-1/+3
| | | | | | | options over to the new style. Notes: svn path=/head/; revision=13255
* Gack - if you're going to call semexit() from elsewhere, it shouldn'tJordan K. Hubbard1995-12-281-2/+2
| | | | | | | be static.. :-) Notes: svn path=/head/; revision=13072
* Call semexit() from exit(), in order to process `undo vectors'.Joerg Wunsch1995-12-271-2/+1
| | | | | | | This function has actually never been called. Notes: svn path=/head/; revision=13060
* Update sysv_*.c to get their argument definitions from sysproto.hPeter Wemm1995-12-151-14/+27
| | | | Notes: svn path=/head/; revision=12866
* A Major staticize sweep. Generates a couple of warnings that I'll dealPoul-Henning Kamp1995-12-141-14/+16
| | | | | | | | | with later. A number of unused vars removed. A number of unused procs removed or #ifdefed. Notes: svn path=/head/; revision=12819
* Start including <sys/sysproto.h> to get the correct args structs andBruce Evans1995-10-211-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | prototypes for all syscalls. The args structs are still declared in comments as in VOP implementation functions. I don't like the duplication for this, but several more layers of changes are required to get it right. First we need to catch up with 4.4lite2, which uses macros to handle struct padding. Then we need to catch up with NetBSD, which passes the args correctly (as void *). Then we need to handle varargs functions and struct padding better. I think all the details can be hidden in machine-generated functions so that the args structs and verbose macros to reference them don't have to appear in the core sources. Add prototypes. Add bogus casts to hide the evil type puns exposed by the previous steps. &uap[1] was used to get at the args after the first. This worked because only the first arg in *uap was declared. This broke when the machine- genenerated args struct declared all the args (actually it declares extra args in some cases and depends on the user stack having some accessible junk after the last arg, not to mention the user args being on the stack. It isn't possible to declare a correct args struct for a varargs syscall). The msgsys(), semsys() and shmsys() syscall interfaces are BAD because they multiplex several syscalls that have different types of args. There was no reason to duplicate this sysv braindamage but now we're stuck with it. NetBSD has reimplemented the syscalls properly as separate syscalls #220-231. Declare static functions as static in both their prototype and their implementation (the latter is optional, and this misfeature was used). Remove gratuitous #includes. Continue cleaning up new init stuff. Notes: svn path=/head/; revision=11626
* Fixed init functions argument type - caddr_t -> void *. Fixed a couple ofDavid Greenman1995-09-091-3/+3
| | | | | | | compiler warnings. Notes: svn path=/head/; revision=10653
* Fix several sysinit functions that had the wrong type and unnecessarilyBruce Evans1995-08-301-7/+4
| | | | | | | | | | | | external linkage. Remove useless comments saying that SYSINIT() does system initialization. shm.c: Remove nearly useless comment that gave wrong pseudo-prototypes. Notes: svn path=/head/; revision=10428