Skip to content

cblock: add --sysvshm launch option; add postgres example - #133

Closed
csjayp wants to merge 1 commit into
masterfrom
csjp/sysv-ipc
Closed

csjayp wants to merge 1 commit into
masterfrom
csjp/sysv-ipc

Conversation

@csjayp

@csjayp csjayp commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Cellblocks are created with sysvshm=disable, the jail default, so nothing inside them can use SysV shared memory. Some services need it. PostgreSQL still creates a small SysV segment at startup, which it uses as a data directory interlock, even with shared_memory_type=mmap.

Add "cblock launch -S/--sysvshm" (and "sysvshm: true" in the cblock_warden manifest). The option gives the jail its own SysV shared memory namespace (sysvshm=new): segments created in the cellblock are hidden from the host's namespace and from other cellblocks, even ones running under the same user ID. It is off by default to keep the syscall surface small for images that do not need it.

The option is carried in a new p_sysvshm field of struct cblock_launch. This changes the wire format, so CBLOCK_PROTO_VERSION goes to 2. cblockd passes CBLOCK_SYSVSHM=new|disable to stage_launch.sh, which sets sysvshm explicitly on both the vnet and non-vnet jail -c paths.

Add examples/postgres: a PostgreSQL 17 image whose entrypoint runs initdb only when the data directory holds no cluster yet. The superuser password comes from /run/secrets/postgres_password. The README covers the data volume, the secrets mount and --sysvshm.

Document --sysvshm in README.md, including that kern.ipc limits are system-wide and how to cap each cellblock with RCTL.

Cellblocks are created with sysvshm=disable, the jail default, so
nothing inside them can use SysV shared memory. Some services need it.
PostgreSQL still creates a small SysV segment at startup, which it uses
as a data directory interlock, even with shared_memory_type=mmap.

Add "cblock launch -S/--sysvshm" (and "sysvshm: true" in the
cblock_warden manifest). The option gives the jail its own SysV
shared memory namespace (sysvshm=new): segments created in the
cellblock are hidden from the host's namespace and from other
cellblocks, even ones running under the same user ID. It is off by
default to keep the syscall surface small for images that do not
need it.

The option is carried in a new p_sysvshm field of struct cblock_launch.
This changes the wire format, so CBLOCK_PROTO_VERSION goes to 2.
cblockd passes CBLOCK_SYSVSHM=new|disable to stage_launch.sh, which
sets sysvshm explicitly on both the vnet and non-vnet jail -c paths.

Add examples/postgres: a PostgreSQL 17 image whose entrypoint runs
initdb only when the data directory holds no cluster yet. The superuser
password comes from /run/secrets/postgres_password. The README covers
the data volume, the secrets mount and --sysvshm.

Document --sysvshm in README.md, including that kern.ipc limits are
system-wide and how to cap each cellblock with RCTL.
@csjayp csjayp closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant