man: specify that ProtectProc= does not work with root/cap_sys_ptrace
authorLuca Boccassi <bluca@debian.org>
Sun, 14 Mar 2021 12:36:15 +0000 (12:36 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 15 Mar 2021 16:53:16 +0000 (16:53 +0000)
commit301e7cd047c8d07715d5dc37f713e8aa031581b4
tree722c8e30d0302e7e225f72ea30d66bbf030e0e23
parentb63dae3168209a06cefe2b9916667b7754b7de34
man: specify that ProtectProc= does not work with root/cap_sys_ptrace

When using hidepid=invisible on procfs, the kernel will check if the
gid of the process trying to access /proc is the same as the gid of
the process that mounted the /proc instance, or if it has the ptrace
capability:

https://github.com/torvalds/linux/blob/v5.10/fs/proc/base.c#L723
https://github.com/torvalds/linux/blob/v5.10/fs/proc/root.c#L155

Given we set up the /proc instance as root for system services,
The same restriction applies to CAP_SYS_PTRACE, if a process runs with
it then hidepid=invisible has no effect.

ProtectProc effectively can only be used with User= or DynamicUser=yes,
without CAP_SYS_PTRACE.
Update the documentation to explicitly state these limitations.

Fixes #18997
man/systemd.exec.xml