/[base]/head/sys/kern/sysv_sem.c
ViewVC logotype

Log of /head/sys/kern/sysv_sem.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:


Revision 366932 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 22 09:28:11 2020 UTC (3 years, 8 months ago) by kib
File length: 51040 byte(s)
Diff to previous 366584
sysv_sem: semusz depends on semume.

Size of the per-process semaphore undo structure (semusz) depends on
the number of the per-process undos.  If kern.ipc.semume is adjusted,
semusz must be adjusted as well, and it makes no sense to delegate
adjustment to user.  Make it automatic.

Reported and tested by:	Olef <o.vandestadt@gmail.com>
PR:	250361
Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26826


Revision 366584 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 9 20:20:42 2020 UTC (3 years, 8 months ago) by jhb
File length: 50989 byte(s)
Diff to previous 363055
Don't invoke semunload() if seminit() fails during MOD_LOAD.

The module handler code invokes a MOD_UNLOAD event immediately if
MOD_LOAD fails.  The result was that if seminit() failed, semunload()
was invoked twice.  semunload() is not idempotent however and would
try to remove it's process_exit eventhandler twice resulting in a
panic.

Reviewed by:	kib, markj
Obtained from:	CheriBSD
MFC after:	1 month
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26696


Revision 363055 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 9 18:34:54 2020 UTC (3 years, 11 months ago) by markj
File length: 51023 byte(s)
Diff to previous 359937
Apply the logic from r363051 to semctl(2) and __sem_base field.

Reported by:	Jeffball <jeffball@grimm-co.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25600


Revision 359937 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 14 20:30:48 2020 UTC (4 years, 2 months ago) by brooks
File length: 50833 byte(s)
Diff to previous 357984
Centralize compatability translation macros.

Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
and replace existing definitation with includes where required. This
eliminates duplicate code and allows Linux and FreeBSD compatability
headers to be included in the same files.

Input from:	cem, jhb
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24275


Revision 357984 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 15 23:19:23 2020 UTC (4 years, 4 months ago) by kib
File length: 50890 byte(s)
Diff to previous 357983
sem_remove(): fix the loop that compacts sem array on semaphores removal.

As written now, it copies random kernel memory from beyond the bounds
of the array.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation (kib)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23694


Revision 357983 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 15 23:18:02 2020 UTC (4 years, 4 months ago) by kib
File length: 50861 byte(s)
Diff to previous 357982
sem_remove(): add some asserts.

Assert that sema[idx] allocation from sem[] is sane.
Also assert that sem_mtx is owned, it protects the SEM_ALLOC flag.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation (kib)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23694


Revision 357982 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 15 23:15:42 2020 UTC (4 years, 4 months ago) by kib
File length: 50608 byte(s)
Diff to previous 357525
Use designated initializers for seminfo.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation (kib)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23694


Revision 357525 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 4 20:00:45 2020 UTC (4 years, 4 months ago) by markj
File length: 50725 byte(s)
Diff to previous 332122
Correct the malloc tag used when freeing the temporary semop(2) buffer.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation


Revision 332122 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 6 17:35:35 2018 UTC (6 years, 2 months ago) by brooks
File length: 50723 byte(s)
Diff to previous 330297
Move most of the contents of opt_compat.h to opt_global.h.

opt_compat.h is mentioned in nearly 180 files. In-progress network
driver compabibility improvements may add over 100 more so this is
closer to "just about everywhere" than "only some files" per the
guidance in sys/conf/options.

Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
is created on all architectures.

Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
set of compiled files.

Reviewed by:	kib, cem, jhb, jtl
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14941


Revision 330297 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 2 22:10:48 2018 UTC (6 years, 4 months ago) by brooks
File length: 50747 byte(s)
Diff to previous 329525
Rename kernel-only members of semid_ds and msgid_ds.

This deliberately breaks the API in preperation for future syscall
revisions which will remove these nonstandard members.

In an exp-run a single port (devel/qemu-user-static) was found to
use them which it did becuase it emulates system calls.  This has
been fixed in the ports tree.

PR:		224443 (exp-run)
Reviewed by:	kib, jhb (previous version)
Exp-run by:	antoine
Sponsored by:	DARPA, AFRP
Differential Revision:	https://reviews.freebsd.org/D14490


Revision 329525 - (view) (download) (annotate) - [select for diffs]
Modified Sun Feb 18 19:19:36 2018 UTC (6 years, 4 months ago) by brooks
File length: 50671 byte(s)
Diff to previous 328799
Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids).

The description of kern.ipc.shmsegs was wrong since 2005.  I updated the
others (which were more correct) to match.

PR:		225933
Reviewed by:	cem
MFC after:	3 days
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14391


Revision 328799 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 2 18:03:12 2018 UTC (6 years, 5 months ago) by brooks
File length: 50627 byte(s)
Diff to previous 326271
Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32.

Stop leaking kernel pointers though theses sysctls and make sure that the
padding in the structures is zeroed on allocation to avoid other leaks.

Reviewed by:	gordon, kib
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D13459


Revision 326271 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 27 15:20:12 2017 UTC (6 years, 7 months ago) by pfg
File length: 49970 byte(s)
Diff to previous 324733
sys/kern: adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


Revision 324733 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 19 00:31:00 2017 UTC (6 years, 8 months ago) by mjg
File length: 49918 byte(s)
Diff to previous 316308
sysvsem: check if semu_list has anything on it before grabbing the lock

This should get a process-specific support instead.

MFC after:	1 week


Revision 316308 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 30 22:26:15 2017 UTC (7 years, 3 months ago) by rwatson
File length: 49879 byte(s)
Diff to previous 316185
Audit arguments to System V IPC system calls implementing sempahores,
message queues, and shared memory.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL


Revision 316185 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 29 23:31:35 2017 UTC (7 years, 3 months ago) by rwatson
File length: 49379 byte(s)
Diff to previous 298819
When handling msgsys(2), semsys(2), and shmsys(2) multiplex system calls,
map the 'which' argument into a suitable audit event identifier for the
specific operation requested.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL


Revision 298819 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 29 22:15:33 2016 UTC (8 years, 2 months ago) by pfg
File length: 49273 byte(s)
Diff to previous 298661
sys/kern: spelling fixes in comments.

No functional change.


Revision 298661 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 26 19:57:35 2016 UTC (8 years, 2 months ago) by cem
File length: 49270 byte(s)
Diff to previous 298656
osd(9): Change array pointer to array pointer type from void*

This is a minor follow-up to r297422, prompted by a Coverity warning.  (It's
not a real defect, just a code smell.)  OSD slot array reservations are an
array of pointers (void **) but were cast to void* and back unnecessarily.
Keep the correct type from reservation to use.

osd.9 is updated to match, along with a few trivial igor fixes.

Reported by:	Coverity
CID:		1353811
Sponsored by:	EMC / Isilon Storage Division


Revision 298656 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 26 18:17:44 2016 UTC (8 years, 2 months ago) by jamie
File length: 49269 byte(s)
Diff to previous 298585
Redo the changes to the SYSV IPC sysctl functions from r298585, so they
don't (mis)use sbufs.

PR:		48471


Revision 298585 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 25 17:06:50 2016 UTC (8 years, 2 months ago) by jamie
File length: 49517 byte(s)
Diff to previous 298433
Encapsulate SYSV IPC objects in jails.  Define per-module parameters
sysvmsg, sysvsem, and sysvshm, with the following bahavior:

inherit: allow full access to the IPC primitives.  This is the same as
the current setup with allow.sysvipc is on.  Jails and the base system
can see (and moduly) each other's objects, which is generally considered
a bad thing (though may be useful in some circumstances).

disable: all no access, same as the current setup with allow.sysvipc off.

new: A jail may see use the IPC objects that it has created.  It also
gets its own IPC key namespace, so different jails may have their own
objects using the same key value.  The parent jail (or base system) can
see the jail's IPC objects, but not its keys.

PR:		48471
Submitted by:	based on work by kikuchan98@gmail.com
MFC after:	5 days


Revision 298433 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 21 19:57:40 2016 UTC (8 years, 2 months ago) by pfg
File length: 41957 byte(s)
Diff to previous 298354
sys: use our roundup2/rounddown2() macros when param.h is available.

rounddown2 tends to produce longer lines than the original code
and when the code has a high indentation level it was not really
advantageous to do the replacement.

This tries to strike a balance between readability using the macros
and flexibility of having the expressions, so not everything is
converted.


Revision 298354 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 20 16:19:44 2016 UTC (8 years, 2 months ago) by pfg
File length: 41982 byte(s)
Diff to previous 298310
Indentation issues.

Contract some lines leftover from r298310.

Mea culpa.


Revision 298310 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 19 23:48:27 2016 UTC (8 years, 2 months ago) by pfg
File length: 41987 byte(s)
Diff to previous 298069
kernel: use our nitems() macro when it is available through param.h.

No functional change, only trivial cases are done in this sweep,

Discussed in:	freebsd-current


Revision 298069 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 15 16:10:11 2016 UTC (8 years, 2 months ago) by pfg
File length: 42007 byte(s)
Diff to previous 295385
kern: for pointers replace 0 with NULL.

These are mostly cosmetical, no functional change.

Found with devel/coccinelle.


Revision 295385 - (view) (download) (annotate) - [select for diffs]
Modified Sun Feb 7 22:12:39 2016 UTC (8 years, 4 months ago) by jilles
File length: 42001 byte(s)
Diff to previous 282213
semget(): Check for [EEXIST] error first.

Although POSIX literally permits failing with [EINVAL] if IPC_CREAT and
IPC_EXCL were both passed, the semaphore set already exists and has fewer
semaphores than nsems, this does not allow an application to retry safely:
if the [EINVAL] is actually because of the semmsl limit, an infinite loop
would result.

PR:		206927


Revision 282213 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 29 10:23:02 2015 UTC (9 years, 2 months ago) by trasz
File length: 42001 byte(s)
Diff to previous 273707
Add kern.racct.enable tunable and RACCT_DISABLED config option.
The point of this is to be able to add RACCT (with RACCT_DISABLED)
to GENERIC, to avoid having to rebuild the kernel to use rctl(8).

Differential Revision:	https://reviews.freebsd.org/D2369
Reviewed by:	kib@
MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation


Revision 273707 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 26 19:42:44 2014 UTC (9 years, 8 months ago) by mjg
File length: 41929 byte(s)
Diff to previous 267992
Avoid dynamic syscall overhead for statically compiled modules.

The kernel tracks syscall users so that modules can safely unregister them.

But if the module is not unloadable or was compiled into the kernel, there is
no need to do this.

Achieve this by adding SY_THR_STATIC_KLD macro which expands to SY_THR_STATIC
during kernel build and 0 otherwise.

Reviewed by:	kib (previous version)
MFC after:	2 weeks


Revision 267992 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 28 03:56:17 2014 UTC (10 years ago) by hselasky
File length: 41891 byte(s)
Diff to previous 267985
Pull in r267961 and r267973 again. Fix for issues reported will follow.


Revision 267985 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 27 22:05:21 2014 UTC (10 years ago) by gjb
File length: 42387 byte(s)
Diff to previous 267961
Revert r267961, r267973:

These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory


Revision 267961 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 27 16:33:43 2014 UTC (10 years ago) by hselasky
File length: 41891 byte(s)
Diff to previous 225617
Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies


Revision 225617 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 16 13:58:51 2011 UTC (12 years, 9 months ago) by kmacy
File length: 42387 byte(s)
Diff to previous 224016
In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)


Revision 224016 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 14 14:18:14 2011 UTC (12 years, 11 months ago) by bz
File length: 42338 byte(s)
Diff to previous 223825
Remove semaphore map entry count "semmap" field and its tuning
option that is highly recommended to be adjusted in too much
documentation while doing nothing in FreeBSD since r2729 (rev 1.1).

ipcs(1) needs to be recompiled as it is accessing _KERNEL private
variables.

Reviewed by:	jhb (before comment change on linux code)
Sponsored by:	Sandvine Incorporated


Revision 223825 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 6 20:06:44 2011 UTC (13 years ago) by trasz
File length: 42658 byte(s)
Diff to previous 220399
All the racct_*() calls need to happen with the proc locked.  Fixing this
won't happen before 9.0.  This commit adds "#ifdef RACCT" around all the
"PROC_LOCK(p); racct_whatever(p, ...); PROC_UNLOCK(p)" instances, in order
to avoid useless locking/unlocking in kernels built without "options RACCT".


Revision 220399 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 6 19:08:50 2011 UTC (13 years, 3 months ago) by trasz
File length: 42618 byte(s)
Diff to previous 220398
Style fix.

Submitted by:	jhb@


Revision 220398 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 6 18:11:24 2011 UTC (13 years, 3 months ago) by trasz
File length: 42626 byte(s)
Diff to previous 220388
Add accounting for SysV-related resources.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib (earlier version)


Revision 220388 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 6 16:59:54 2011 UTC (13 years, 3 months ago) by trasz
File length: 42195 byte(s)
Diff to previous 219028
Add ucred pointer to the SysV-related memory structures.  This is required
for racct.

Note that after this commit, ipcs(1) needs to be rebuilt.  Otherwise, it will
fail with "ipcs: sysctlbyname: kern.ipc.msqids: Cannot allocate memory".

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib (earlier version)


Revision 219028 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 25 10:11:01 2011 UTC (13 years, 4 months ago) by netchild
File length: 42101 byte(s)
Diff to previous 217555
Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/
PMC/SYSV/...).

No FreeBSD version bump, the userland application to query the features will
be committed last and can serve as an indication of the availablility if
needed.

Sponsored by:   Google Summer of Code 2010
Submitted by:   kibab
Reviewed by:    arch@ (parts by rwatson, trasz, jhb)
X-MFC after:    to be determined in last commit with code from this project


Revision 217555 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 18 21:14:18 2011 UTC (13 years, 5 months ago) by mdf
File length: 42050 byte(s)
Diff to previous 215281
Specify a CTLTYPE_FOO so that a future sysctl(8) change does not need
to rely on the format string.


Revision 215281 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 14 06:09:50 2010 UTC (13 years, 7 months ago) by brucec
File length: 42033 byte(s)
Diff to previous 209037
Add some descriptions to sys/kern sysctls.

PR:	kern/148710
Tested by:	Chip Camden <sterling at camdensoftware.com>
MFC after:	1 week


Revision 209037 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 11 09:27:33 2010 UTC (14 years ago) by ivoras
File length: 42016 byte(s)
Diff to previous 205323
In another move to join with the age of the Fruitbat, increase SYSV
shared resources defaults beyond absolute minimums.

The new values are chosen mostly by magic. They are still fairly
small and will need increasing for large installations (especially
SHMMAX). However, they are now enough to e.g. start PostgreSQL
installations with ~~300 users and nearly 512 MB of shared buffers.

Reviewed by:	A short discussion on hackers@


Revision 205323 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 19 11:04:42 2010 UTC (14 years, 3 months ago) by kib
File length: 42014 byte(s)
Diff to previous 194910
Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding
sysv_{msg,sem,shm}.c files.

Mark SysV IPC freebsd32 syscalls as NOSTD and add required
SYSCALL_INIT_HELPER/SYSCALL32_INIT_HELPERs to provide auto
register/unregister on module load.

This makes COMPAT_FREEBSD32 functional with SysV IPC compiled and loaded
as modules.

Reviewed by:	jhb
MFC after:	2 weeks


Revision 194910 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 24 21:10:52 2009 UTC (15 years ago) by jhb
File length: 37159 byte(s)
Diff to previous 194894
Change the ABI of some of the structures used by the SYSV IPC API:
- The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned
  short.
- The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned
  short.
- The mode member of struct ipc_perm is now mode_t instead of unsigned short
  (this is merely a style bug).
- The rather dubious padding fields for ABI compat with SV/I386 have been
  removed from struct msqid_ds and struct semid_ds.
- The shm_segsz member of struct shmid_ds is now a size_t instead of an
  int.  This removes the need for the shm_bsegsz member in struct
  shmid_kernel and should allow for complete support of SYSV SHM regions
  >= 2GB.
- The shm_nattch member of struct shmid_ds is now an int instead of a
  short.
- The shm_internal member of struct shmid_ds is now gone.  The internal
  VM object pointer for SHM regions has been moved into struct
  shmid_kernel.
- The existing __semctl(), msgctl(), and shmctl() system call entries are
  now marked COMPAT7 and new versions of those system calls which support
  the new ABI are now present.
- The new system calls are assigned to the FBSD-1.1 version in libc.  The
  FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls.
- A simplistic framework for tagging system calls with compatibility
  symbol versions has been added to libc.  Version tags are added to
  system calls by adding an appropriate __sym_compat() entry to
  src/lib/libc/incldue/compat.h. [1]

PR:		kern/16195 kern/113218 bin/129855
Reviewed by:	arch@, rwatson
Discussed with:	kan, kib [1]


Revision 194894 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 24 20:01:13 2009 UTC (15 years ago) by jhb
File length: 35493 byte(s)
Diff to previous 194832
Deprecate the msgsys(), semsys(), and shmsys() system calls by moving
them under COMPAT_FREEBSD[4567].  Starting with FreeBSD 5.0 the SYSV IPC
API was implemented via direct system calls (e.g. msgctl(), msgget(), etc.)
rather than indirecting through the var-args *sys() system calls.  The
shmsys() system call was already effectively deprecated for all but
COMPAT_FREEBSD4 already as its implementation for the !COMPAT_FREEBSD4 case
was to simply invoke nosys().


Revision 194832 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 24 13:35:38 2009 UTC (15 years ago) by jhb
File length: 35259 byte(s)
Diff to previous 193511
- Move syscall function argument structure types to be just above the
  relevenat system call function.
- Whitespace fixes.


Revision 193511 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 5 14:55:22 2009 UTC (15 years, 1 month ago) by rwatson
File length: 35260 byte(s)
Diff to previous 192895
Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC
and used in a large number of files, but also because an increasing number
of incorrect uses of MAC calls were sneaking in due to copy-and-paste of
MAC-aware code without the associated opt_mac.h include.

Discussed with:	pjd


Revision 192895 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 27 14:11:23 2009 UTC (15 years, 1 month ago) by jamie
File length: 35281 byte(s)
Diff to previous 190557
Add hierarchical jails.  A jail may further virtualize its environment
by creating a child jail, which is visible to that jail and to any
parent jails.  Child jails may be restricted more than their parents,
but never less.  Jail names reflect this hierarchy, being MIB-style
dot-separated strings.

Every thread now points to a jail, the default being prison0, which
contains information about the physical system.  Prison0's root
directory is the same as rootvnode; its hostname is the same as the
global hostname, and its securelevel replaces the global securelevel.
Note that the variable "securelevel" has actually gone away, which
should not cause any problems for code that properly uses
securelevel_gt() and securelevel_ge().

Some jail-related permissions that were kept in global variables and
set via sysctls are now per-jail settings.  The sysctls still exist for
backward compatibility, used only by the now-deprecated jail(2) system
call.

Approved by:	bz (mentor)


Revision 190557 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 30 15:01:29 2009 UTC (15 years, 3 months ago) by brueffer
File length: 35281 byte(s)
Diff to previous 187298
Fix memory leak in semunload().

PR:		133064
Submitted by:	Mateusz Guzik <mjguzik@gmail.com>
MFC after:	1 week


Revision 187298 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 15 12:15:46 2009 UTC (15 years, 5 months ago) by kib
File length: 35257 byte(s)
Diff to previous 187223
Lock the semaphore identifier lock during semaphore initialization to
guarantee atomicity of the operation for other semaphore consumers.
In particular, this should guard against access to the semaphore with
not done or partially done MAC label assignment.

Reviewed by:	rwatson
MFC after:	1 month


Revision 187223 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 14 15:20:13 2009 UTC (15 years, 5 months ago) by kib
File length: 35100 byte(s)
Diff to previous 179879
It seems that there are at least three issues with IPC_RMID operation
on SysV semaphores.

  The squeeze of the semaphore array in the kern_semctl() modifies
  sem_base for the semaphores with sem_base greater then sem_base of
  the removed semaphore, as well as the values of the semaphores,
  without locking their mutex. This can lead to (killable) hangs or
  unexpected behaviour of the processes performing any sem operations
  while other process does IPC_RMID.

  The semexit_myhook() eventhandler unlocks SEMUNDO_LOCK() while
  accessing *suptr. This allows for IPC_RMID for the sem id to be
  performed in parallel with undo hook referenced by the current undo
  structure. This leads to the panic("semexit - semid not allocated") [1].

  The semaphore creation is protected by Giant, while IPC_RMID is done
  while only semaphore mutex is held. This seems to result in invalid
  values for semtot, causing random ENOSPC error returns [2].

Redo the locking of the semaphores lifetime cycle. Delegate the
sem_mtx to the sole purpose of protecting semget() and
semctl(IPC_RMID). Introduce new sem_undo_mtx to protect SEM_UNDO
handling. Remove the Giant remnants from the code.
Note that  mac_sysvsem_check_semget() and mac_sysvsem_create() are
now called while sem_mtx is held, as well as mac_sysvsem_cleanup() [3].

When semaphore is removed, acquire semaphore locks for all semaphores
with sem_base that is going to be changed by squeeze of the sema
array. The lock order is not important there, because the region is
protected by sem_mtx.

Organize both used and free sem_undo structures into the lists,
protected by sem_undo_mtx. In semexit_myhook(), remove sem_undo
structure that is being processed, from used list, without putting it
onto the free to prevent modifications by other threads. This allows
for sem_undo_lock to be dropped to acquire individial semaphore locks
without violating lock order. Since IPC_RMID may no longer find this
sem_undo, do tolerate references to unallocated semaphores in undo
structure, and check sequential number to not undo unrelated semaphore
with the same id.

While there, convert functions definitions to ANSI C and fix small
style(9) glitches.

Reported by:	Omer Faruk Sen <omerfsen gmail com> [1], pho [2]
Reviewed by:	rwatson [3]
Tested by:	pho
MFC after:	1 month


Revision 179879 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 19 18:08:42 2008 UTC (16 years ago) by gonzo
File length: 35200 byte(s)
Diff to previous 172930
Renew semaphore's pointer after wakeup since during msleep
sem_base may have been modified by destroying one of semaphores
and semptr would not be valid in this case.

PR: kern/123731


Revision 172930 - (view) (download) (annotate) - [select for diffs]
Modified Wed Oct 24 19:04:04 2007 UTC (16 years, 8 months ago) by rwatson
File length: 34994 byte(s)
Diff to previous 171179
Merge first in a series of TrustedBSD MAC Framework KPI changes
from Mac OS X Leopard--rationalize naming for entry points to
the following general forms:

  mac_<object>_<method/action>
  mac_<object>_check_<method/action>

The previous naming scheme was inconsistent and mostly
reversed from the new scheme.  Also, make object types more
consistent and remove spaces from object types that contain
multiple parts ("posix_sem" -> "posixsem") to make mechanical
parsing easier.  Introduce a new "netinet" object type for
certain IPv4/IPv6-related methods.  Also simplify, slightly,
some entry point names.

All MAC policy modules will need to be recompiled, and modules
not updates as part of this commit will need to be modified to
conform to the new KPI.

Sponsored by:	SPARTA (original patches against Mac OS X)
Obtained from:	TrustedBSD Project, Apple Computer


Revision 171179 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 3 15:58:47 2007 UTC (17 years ago) by kib
File length: 34986 byte(s)
Diff to previous 167904
Relock the sema_mtxp unconditionally after copyin() for SETALL case in
kern_semctl. Otherwise, later mtx_unlock() can operate on unlocked mutex.

Submitted by:	rdivacky
MFC after:	3 days
Approved by:	re (kensmith)


Revision 167904 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 26 17:41:14 2007 UTC (17 years, 3 months ago) by emaste
File length: 34986 byte(s)
Diff to previous 167232
Avoid manipulating semu_list outside of the scope of SEMUNDO_LOCK().  This
would lead to an occasional hang with a cycle in semu_list.

X-Discussed-On: hackers@


Revision 167232 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 5 13:10:58 2007 UTC (17 years, 4 months ago) by rwatson
File length: 34942 byte(s)
Diff to previous 167211
Further system call comment cleanup:

- Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde)
- Remove extra blank lines in some cases.
- Add extra blank lines in some cases.
- Remove no-op comments consisting solely of the function name, the word
  "syscall", or the system call name.
- Add punctuation.
- Re-wrap some comments.


Revision 167211 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 4 22:36:48 2007 UTC (17 years, 4 months ago) by rwatson
File length: 34945 byte(s)
Diff to previous 163606
Remove 'MPSAFE' annotations from the comments above most system calls: all
system calls now enter without Giant held, and then in some cases, acquire
Giant explicitly.

Remove a number of other MPSAFE annotations in the credential code and
tweak one or two other adjacent comments.


Revision 163606 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 22 11:52:19 2006 UTC (17 years, 8 months ago) by rwatson
File length: 35007 byte(s)
Diff to previous 162468
Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.h
begun with a repo-copy of mac.h to mac_framework.h.  sys/mac.h now
contains the userspace and user<->kernel API and definitions, with all
in-kernel interfaces moved to mac_framework.h, which is now included
across most of the kernel instead.

This change is the first step in a larger cleanup and sweep of MAC
Framework interfaces in the kernel, and will not be MFC'd.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA


Revision 162468 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 20 13:40:00 2006 UTC (17 years, 9 months ago) by rwatson
File length: 34987 byte(s)
Diff to previous 160293
Remove MAC_DEBUG + MPRINTF debugging from System V IPC.  This no longer
appears to be serving a useful purpose, as it was used during initial
development of MAC support for System V IPC.

MFC after:	1 month
Obtained from:	TrustedBSD Project
Suggested by:	Christopher dot Vance at SPARTA dot com


Revision 160293 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 12 11:41:53 2006 UTC (17 years, 11 months ago) by kib
File length: 35345 byte(s)
Diff to previous 160187
Use proper format specifier for pointers in debug printfs (turned off
by default).

Approved by:	pjd (mentor)
MFC after:	2 weeks


Revision 160187 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 8 19:51:38 2006 UTC (17 years, 11 months ago) by jhb
File length: 35321 byte(s)
Diff to previous 160028
Rework kern_semctl a bit to always assume the UIO_SYSSPACE case.  This
mostly consists of pushing a few copyin's and copyout's up into
__semctl() as all the other callers were already doing the UIO_SYSSPACE
case.  This also changes kern_semctl() to set the return value in a passed
in pointer to a register_t rather than td->td_retval[0] directly so that
callers can only set td->td_retval[0] if all the various copyout's succeed.

As a result of these changes, kern_semctl() no longer does copyin/copyout
(except for GETALL/SETALL) so simplify the locking to acquire the semakptr
mutex before the MAC check and hold it all the way until the end of the
big switch statement.  The GETALL/SETALL cases have to temporarily drop it
while they do copyin/malloc and copyout.  Also, simplify the SETALL case to
remove handling for a non-existent race condition.


Revision 160028 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 29 13:58:36 2006 UTC (18 years ago) by jhb
File length: 35161 byte(s)
Diff to previous 159991
Fix semctl(2) breakage from the previous commit.  Previously __semctl() had
a local 'semid' variable which was the array index and used uap->semid
as the original IPC id.  During the kern_semctl() conversion those two
variables were collapsed into a single 'semid' variable breaking the
places that needed the original IPC ID.  To fix, add a new 'semidx'
variable to hold the array index and leave 'semid' unmolested as the IPC
id.  While I'm here, explicitly document that the (undocumented, at least
in semctl(2)) SEM_STAT command curiously expects an array index in the
'semid' parameter rather than an IPC id.

Submitted by:	maxim


Revision 159991 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 27 18:28:50 2006 UTC (18 years ago) by jhb
File length: 35045 byte(s)
Diff to previous 159481
- Add a kern_semctl() helper function for __semctl().  It accepts a pointer
  to a copied-in copy of the 'union semun' and a uioseg to indicate which
  memory space the 'buf' pointer of the union points to.  This is then used
  in linux_semctl() and svr4_sys_semctl() to eliminate use of the stackgap.
- Mark linux_ipc() and svr4_sys_semsys() MPSAFE.


Revision 159481 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 10 14:34:07 2006 UTC (18 years ago) by rwatson
File length: 34394 byte(s)
Diff to previous 147091
Move some functions and definitions from uipc_socket2.c to uipc_socket.c:

- Move sonewconn(), which creates new sockets for incoming connections on
  listen sockets, so that all socket allocate code is together in
  uipc_socket.c.

- Move 'maxsockets' and associated sysctls to uipc_socket.c with the
  socket allocation code.

- Move kern.ipc sysctl node to uipc_socket.c, add a SYSCTL_DECL() for it
  to sysctl.h and remove lots of scattered implementations in various
  IPC modules.

- Sort sodealloc() after soalloc() in uipc_socket.c for dependency order
  reasons.  Statisticize soalloc() and sodealloc() as they are now
  required only in uipc_socket.c, and are internal to the socket
  implementation.

After this change, socket allocation and deallocation is entirely
centralized in one file, and uipc_socket2.c consists entirely of socket
buffer manipulation and default protocol switch functions.

MFC after:	1 month


Revision 147091 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 7 05:03:28 2005 UTC (19 years, 1 month ago) by rwatson
File length: 34418 byte(s)
Diff to previous 145230
Gratuitous renaming of four System V Semaphore MAC Framework entry
points to convert _sema() to _sem() for consistency purposes with
respect to the other semaphore-related entry points:

mac_init_sysv_sema() -> mac_init_sysv_sem()
mac_destroy_sysv_sem() -> mac_destroy_sysv_sem()
mac_create_sysv_sema() -> mac_create_sysv_sem()
mac_cleanup_sysv_sema() -> mac_cleanup_sysv_sem()

Congruent changes are made to the policy interface to support this.

Obtained from:	TrustedBSD Project
Sponsored by:	SPAWAR, SPARTA


Revision 145230 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 18 11:51:10 2005 UTC (19 years, 2 months ago) by rwatson
File length: 34422 byte(s)
Diff to previous 143835
Remove end-of-line tabs.

MFC after:	3 days


Revision 143835 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 19 04:34:23 2005 UTC (19 years, 3 months ago) by sam
File length: 34424 byte(s)
Diff to previous 141710
check copyin return value

Noticed by:	Coverity Prevent analysis tool


Revision 141710 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 12 01:22:39 2005 UTC (19 years, 4 months ago) by csjp
File length: 34416 byte(s)
Diff to previous 140615
Add much needed descriptions for a number of the IPC related sysctl OIDs.
This information will be very useful for people who are tuning applications
which have a dependence on IPC mechanisms.

The following OIDs were documented:

Message queues:
 kern.ipc.msgmax
 kern.ipc.msgmni
 kern.ipc.msgmnb
 kern.ipc.msgtlq
 kern.ipc.msgssz
 kern.ipc.msgseg

Semaphores:
 kern.ipc.semmap
 kern.ipc.semmni
 kern.ipc.semmns
 kern.ipc.semmnu
 kern.ipc.semmsl
 kern.ipc.semopm
 kern.ipc.semume
 kern.ipc.semusz
 kern.ipc.semvmx
 kern.ipc.semaem

Shared memory:
 kern.ipc.shmmax
 kern.ipc.shmmin
 kern.ipc.shmmni
 kern.ipc.shmseg
 kern.ipc.shmall
 kern.ipc.shm_use_phys
 kern.ipc.shm_allow_removed
 kern.ipc.shmsegs

These new descriptions can be viewed using sysctl -d

PR:		kern/65219
Submitted by:	Dan Nelson <dnelson at allantgroup dot com> (modified)
No objections:	developers@
Descriptions reviewed by: gnn
MFC after:	1 week


Revision 140615 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 22 19:04:17 2005 UTC (19 years, 5 months ago) by rwatson
File length: 34062 byte(s)
Diff to previous 139804
Invoke label initialization, creation, cleanup, and tear-down MAC
Framework entry points for System V IPC semaphores.

Submitted by:	Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, SPAWAR, McAfee Research


Revision 139804 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 6 23:35:40 2005 UTC (19 years, 5 months ago) by imp
File length: 31309 byte(s)
Diff to previous 137644
/* -> /*- for copyright notices, minor format tweaks as necessary


Revision 137644 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 13 08:06:40 2004 UTC (19 years, 7 months ago) by rwatson
File length: 31308 byte(s)
Diff to previous 137613
Correct two incorrectly merged changes introduced in sysv_sem.c:1.71:
return EINVAL rather than setting error, and don't free sops
unconditionally.  The first change was merged accidentally as part of
the larger set of changes to introduce MAC labels and access control,
and potentially lead to continued processing of a request even after
it was determined to be invalid.  The second change was due to changes
in the semaphore code since the original work was performed.

Pointed out by:	truckman


Revision 137613 - (view) (download) (annotate) - [select for diffs]
Modified Fri Nov 12 13:23:47 2004 UTC (19 years, 7 months ago) by rwatson
File length: 31327 byte(s)
Diff to previous 129882
Second of several commits to allow kernel System V IPC data structures
to be modified and extended without breaking the user space ABI:

Use _kernel variants on _ds structures for System V sempahores, message
queues, and shared memory.  When interfacing with userspace, export
only the _ds subsets of the _kernel data structures.  A lot of search
and replace.

Define the message structure in the _KERNEL portion of msg.h so that it
can be used by other kernel consumers, but not exposed to user space.

Submitted by:	Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, SPAWAR, McAfee Research


Revision 129882 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 30 20:34:58 2004 UTC (20 years, 1 month ago) by phk
File length: 30965 byte(s)
Diff to previous 127108
Add missing #include <sys/module.h>


Revision 127108 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 17 09:37:13 2004 UTC (20 years, 3 months ago) by cperciva
File length: 30941 byte(s)
Diff to previous 123667
Adjust the number of processes waiting on a semaphore properly if we're
woken up in the middle of sleeping.

PR:		misc/64347
Reviewed by:	tjr
MFC after:	7 days


Revision 123667 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 19 13:07:17 2003 UTC (20 years, 6 months ago) by tjr
File length: 30714 byte(s)
Diff to previous 122752
Reduce the overhead of semop() by using the kernel stack instead of
malloc'd memory to store the operations array if it is small enough
to fit.


Revision 122752 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 15 11:56:53 2003 UTC (20 years, 7 months ago) by tjr
File length: 30542 byte(s)
Diff to previous 122390
Initialize sequence numbers to 0 in seminit() instead of using whatever
garbage happens to be in memory. This did not seem to cause any problems
except making semaphore ID's unpredictable (and ugly in ipcs(1) output).


Revision 122390 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 10 07:22:41 2003 UTC (20 years, 7 months ago) by tjr
File length: 30514 byte(s)
Diff to previous 122201
When there are no free sem_undo structs available in semu_alloc(), only
free one sem_undo with un_cnt == 0 instead of all of them. This is a
temporary workaround until the SLIST_FOREACH_PREVPTR loop gets fixed so
that it doesn't cause cycles in semu_list when removing multiple adjacent
items. It might be easier to just use (doubly-linked) LISTs here instead
of complicated SLIST code to achieve O(1) removals.

This bug manifested itself as a complete lockup under heavy semaphore use
by multiple processes with the SEM_UNDO flag set.

PR:		58984


Revision 122201 - (view) (download) (annotate) - [select for diffs]
Modified Fri Nov 7 04:47:14 2003 UTC (20 years, 8 months ago) by rwatson
File length: 30509 byte(s)
Diff to previous 121307
Slight whitespace consistency improvement:
  Trim trailing whitespace.
  Remove unmatched " " before ")".


Revision 121307 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 21 18:28:36 2003 UTC (20 years, 8 months ago) by silby
File length: 30511 byte(s)
Diff to previous 118615
Change all SYSCTLS which are readonly and have a related TUNABLE
from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide
more useful error messages.


Revision 118615 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 7 16:42:27 2003 UTC (20 years, 11 months ago) by nectar
File length: 30493 byte(s)
Diff to previous 116182
Update some argument-documenting comments to match reality.

Add an explicit range check to those same arguments to reduce risk of
cardiac arrest in future code readers.


Revision 116182 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 11 00:56:59 2003 UTC (21 years ago) by obrien
File length: 30472 byte(s)
Diff to previous 112564
Use __FBSDID().


Revision 112564 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 24 21:15:35 2003 UTC (21 years, 3 months ago) by jhb
File length: 30442 byte(s)
Diff to previous 111119
Replace the at_fork, at_exec, and at_exit functions with the slightly more
flexible process_fork, process_exec, and process_exit eventhandlers.  This
reduces code duplication and also means that I don't have to go duplicate
the eventhandler locking three more times for each of at_fork, at_exec, and
at_exit.

Reviewed by:	phk, jake, almost complete silence on arch@


Revision 111119 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 19 05:47:46 2003 UTC (21 years, 4 months ago) by imp
File length: 30248 byte(s)
Diff to previous 110040
Back out M_* changes, per decision of the TRB.

Approved by: trb


Revision 110040 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 29 12:30:59 2003 UTC (21 years, 5 months ago) by tjr
File length: 30195 byte(s)
Diff to previous 109829
Fix two fatal signedness errors introduced when i and j in semop()
were changed from int to size_t in the previous revision.

PR:		47625


Revision 109829 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 25 21:27:37 2003 UTC (21 years, 5 months ago) by alfred
File length: 30178 byte(s)
Diff to previous 109623
Bring semop() closer the the opengroup standards.

PR: 47471
Submitted by: Craig Rodrigues <rodrigc@attbi.com>


Revision 109623 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 21 08:56:16 2003 UTC (21 years, 5 months ago) by alfred
File length: 30168 byte(s)
Diff to previous 105429
Remove M_TRYWAIT/M_WAITOK/M_WAIT.  Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


Revision 105429 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 19 02:07:35 2002 UTC (21 years, 8 months ago) by alfred
File length: 30221 byte(s)
Diff to previous 101774
Don't leak memory in semop(2). (Fix a bug I introduced in rev 1.55.)

Detective work by: jake


Revision 101774 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 13 08:47:17 2002 UTC (21 years, 10 months ago) by alfred
File length: 30208 byte(s)
Diff to previous 101350
Make SYSVSEM mpsafe.  Each semaphore set gets its own lock, however
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.


Revision 101350 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 5 05:16:09 2002 UTC (21 years, 11 months ago) by alfred
File length: 27560 byte(s)
Diff to previous 100523
Cleanup:
Fix line wrapping.
Remove 'register'.
malloc(9) with M_WAITOK can't fail, so remove checks for that.


Revision 100523 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 22 18:27:54 2002 UTC (21 years, 11 months ago) by alfred
File length: 27862 byte(s)
Diff to previous 100511
Cleanup:
Define a debug printf macro rather than wrapping all calls to printf
with #ifdefs.


Revision 100511 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 22 16:12:55 2002 UTC (21 years, 11 months ago) by alfred
File length: 28389 byte(s)
Diff to previous 92723
Remove caddr_t.


Revision 92723 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 19 21:25:46 2002 UTC (22 years, 3 months ago) by alfred
File length: 28503 byte(s)
Diff to previous 92665
Remove __P.


Revision 92665 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 19 10:57:40 2002 UTC (22 years, 3 months ago) by peter
File length: 28569 byte(s)
Diff to previous 91744
Pacify gcc-3.1+, initialize two variables to avoid -Wuninitialized
warnings.


Revision 91744 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 6 12:28:51 2002 UTC (22 years, 4 months ago) by maxim
File length: 28561 byte(s)
Diff to previous 91736
Fix a typo, unbreak the world.

Thanks to:	mux
Approved by:	ru


Revision 91736 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 6 10:52:49 2002 UTC (22 years, 4 months ago) by maxim
File length: 28561 byte(s)
Diff to previous 91703
Maximum semid is seminfo.semmni not seminfo.semmsl.

PR:		kern/34979
Submitted by:	James Gritton <jamie@gritton.org>
Reviewed by:	alfred, ru
Approved by:	ru
MFC after:	1 week


Revision 91703 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 5 18:57:36 2002 UTC (22 years, 4 months ago) by jhb
File length: 28561 byte(s)
Diff to previous 91417
- Use td_ucred for jail checks.
- 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.


Revision 91417 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 27 19:12:14 2002 UTC (22 years, 4 months ago) by jhb
File length: 28698 byte(s)
Diff to previous 91406
Fix Giant leakage in several error cases in __semctl().


Revision 91406 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 27 18:32:23 2002 UTC (22 years, 4 months ago) by jhb
File length: 28706 byte(s)
Diff to previous 90857
Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.


Revision 90857 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 18 16:02:24 2002 UTC (22 years, 4 months ago) by rwatson
File length: 28714 byte(s)
Diff to previous 90817
Rehash of 1.43: simply remove the comment, since it's highly redundant
and only partially correct.


Revision 90817 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 18 00:23:44 2002 UTC (22 years, 4 months ago) by rwatson
File length: 29093 byte(s)
Diff to previous 88715
style(9) prefers formatted comments in '/*' ... '*/' as opposed to
#if 0'd.


Revision 88715 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 30 18:55:09 2001 UTC (22 years, 6 months ago) by alc
File length: 29098 byte(s)
Diff to previous 88633
Eliminate semexit_hook using at_exit(9) and rm_at_exit(9).

Reviewed by:	alfred


Revision 88633 - (view) (download) (annotate) - [select for diffs]
Added Sat Dec 29 07:13:47 2001 UTC (22 years, 6 months ago) by alfred
File length: 29098 byte(s)
Diff to previous 84789
Make AIO a loadable module.

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.



This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27