Skip to content

System V IPC objects not cleaned up with Darwin Sandbox #12548

@wolfgangwalther

Description

@wolfgangwalther

Describe the bug

The darwin sandbox does not clean up System V IPC objects.

Steps To Reproduce

On a darwin system:

  1. Run:
nix-build --no-link -E 'with import <nixpkgs> {};
stdenv.mkDerivation {
  name = "ipc";
  dontUnpack = true;
  doCheck = true;
  nativeCheckInputs = [ postgresqlTestHook postgresql ];
  checkPhase = "runHook preCheck; sleep 1000";
}'`
  1. Cancel the sleeping build.
  2. Run ipcs -ma and see the left-over shared memory segment belonging to a build user.

(you can clean up with ipcrm -m <ID>)

Expected behavior

ipcs -ma should not return any left-over shared memory segments.

Metadata

nix-env (Nix) 2.24.12

Additional context

More details about my analysis:

The Linux sandbox mentions IPC cleanup explicitly:

  • - The IPC namespace prevents the builder from communicating
    with outside processes using SysV IPC mechanisms (shared
    memory, message queues, semaphores). It also ensures
    that all IPC objects are destroyed when the builder
    exits.

Various tickets which are all caused by this:

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugderivation-buildThe process of building an individual derivation (see also sandbox label)macosNix on macOS, aka OS X, aka darwin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions