chiark / gitweb /
core: add RemoveIPC= setting
authorLennart Poettering <lennart@poettering.net>
Mon, 1 Aug 2016 17:24:40 +0000 (19:24 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:49 +0000 (08:50 +0200)
commit67ace99e48cdf843aa0d1cd80a4e080f5c6eb320
tree328bcb2bd85261296c17bcc92df1ce750781a6e8
parent1968f82f3d0a48bcd978b17ef48df906ecdf8074
core: add RemoveIPC= setting

This adds the boolean RemoveIPC= setting to service, socket, mount and swap
units (i.e.  all unit types that may invoke processes). if turned on, and the
unit's user/group is not root, all IPC objects of the user/group are removed
when the service is shut down. The life-cycle of the IPC objects is hence bound
to the unit life-cycle.

This is particularly relevant for units with dynamic users, as it is essential
that no objects owned by the dynamic users survive the service exiting. In
fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set.

In order to communicate the UID/GID of an executed process back to PID 1 this
adds a new "user lookup" socket pair, that is inherited into the forked
processes, and closed before the exec(). This is needed since we cannot do NSS
from PID 1 due to deadlock risks, However need to know the used UID/GID in
order to clean up IPC owned by it if the unit shuts down.
src/login/logind-user.c
src/shared/clean-ipc.c
src/shared/clean-ipc.h