Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jun 2021 16:41:00 +0200
From:      Michael Gmelin <freebsd@grem.de>
To:        jail@freebsd.org
Subject:   POSIX shared memory and dying jails
Message-ID:  <20210625164100.73c71055@bsd64.grem.de>

next in thread | raw e-mail | index | archive | help
Hi,

It seems like non-anonymous POSIX shared memory is not freed
automatically when a jail is removed and keeps it in a dying state,
until the shared memory segment is deleted manually.

See below for the most basic example:

    [root@jailhost ~]# jail -c path=/ command=/bin/sh
    # posixshmcontrol create /removeme
    # exit
    [root@jailhost ~]# jls -dv -j shmtest dying
    true

So at this point, the jail is stuck in a dying state.

Checking POSIX shared memory segments shows the shared memory segment
which is stopping the jail from crossing the Styx:

    [root@jailhost ~]# posixshmcontrol list
    MODE            OWNER   GROUP   SIZE    PATH
    rw-------       root    wheel   0       /removeme

After removing the shared memory segment manually...

    [root@jailhost ~]# posixshmcontrol rm /removeme

the jail passes away peacefully:

    [root@jailhost ~]#  jls -dv -j shmtest dying
    jls: jail "shmtest" not found

I wonder if it wouldn't make sense to always remove POSIX shared memory
created by a jail automatically when it's removed.

Best,
Michael

-- 
Michael Gmelin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210625164100.73c71055>