Index: lib/libc/sys/shmctl.2 =================================================================== --- lib/libc/sys/shmctl.2 +++ lib/libc/sys/shmctl.2 @@ -72,15 +72,18 @@ .It Dv IPC_RMID Removes the segment from the system. The removal will not take -effect until all processes having attached the segment have exited; -however, once the IPC_RMID operation has taken place, no further -processes will be allowed to attach the segment. +effect until all processes having attached the segment have exited. For the operation to succeed, the calling process's effective uid must match .Fa shm_perm.uid or .Fa shm_perm.cuid , or the process must have superuser privileges. +Unless the +.Va kern.ipc.shm_allow_removed +.Xr sysctl 3 +variable has been set to 0, once the IPC_RMID operation has taken place, +no further processes will be allowed to attach the segment. .\" .It Dv SHM_LOCK .\" Locks the segment in memory. The calling process must have .\" superuser privileges. Not implemented in FreeBSD. Index: sys/kern/sysv_shm.c =================================================================== --- sys/kern/sysv_shm.c +++ sys/kern/sysv_shm.c @@ -162,7 +162,7 @@ }; static int shm_use_phys; -static int shm_allow_removed; +static int shm_allow_removed = 1; SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RWTUN, &shminfo.shmmax, 0, "Maximum shared memory segment size");