Page MenuHomeFreeBSD

Make kern.ipc.shm_allow_removed default to 1.
ClosedPublic

Authored by trasz on Sep 8 2015, 6:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 7, 9:04 PM
Unknown Object (File)
Tue, Nov 26, 5:19 PM
Unknown Object (File)
Nov 14 2024, 9:10 PM
Unknown Object (File)
Sep 24 2024, 3:11 AM
Unknown Object (File)
Sep 18 2024, 4:22 AM
Unknown Object (File)
Sep 17 2024, 2:32 AM
Unknown Object (File)
Sep 17 2024, 2:31 AM
Unknown Object (File)
Sep 17 2024, 2:31 AM
Subscribers

Details

Summary

This change changes the default setting of kern.ipc.shm_allow_removed from
0 to 1. This removes the need of manually changing this flag for Google Chrome
users. It also improves compatibility with Linux applications running under
Linuxulator compatibility layer, and possibly also helps in porting software
from Linux.

Generally speaking, the flag allows applications to create the shared memory
segment, attach it, remove it, and then continue to use it and to reattach it
later. This means that the kernel will automatically "clean up" after the
application exits.

It could be argued that it's against POSIX. However, SUSv3 says this
about IPC_RMID: "Remove the shared memory identifier specified by shmid from
the system and destroy the shared memory segment and shmid_ds data structure
associated with it." From my reading, we break it in any case by deferring
removal of the segment until it's detached; we won't break it any more
by also deferring removal of the identifier.

This is the behaviour exhibited by Linux since... probably always, and
also by OpenBSD since the following commit:

revision 1.54
date: 2011/10/27 07:56:28; author: robert; state: Exp; lines: +3 -8;
Allow segments to be used even after they were marked for deletion with
the IPC_RMID flag.
This is permitted as an extension beyond the standards and this is similar
to what other operating systems like linux do.

MFC after: 1 month
Relnotes: yes

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

trasz retitled this revision from to Make kern.ipc.shm_allow_removed default to 1..
trasz updated this object.
trasz edited the test plan for this revision. (Show Details)

There's an interesting perspective on a similar topic in the NetBSD world: http://mail-index.netbsd.org/tech-userlevel/2015/08/25/msg009291.html

This revision was automatically updated to reflect the committed changes.