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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 23 Mar 2021 00:32:14 +0000 (01:32 +0100)
commitdc7d655abc1e3feab17ad74b51421e2f6ac8aee8
treee4e5505c531c40a5d7b7da76de001c33554eb6e2
parent438777cc00ccf2c05f8a05fa02907aa7be547719
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

(cherry picked from commit 301e7cd047c8d07715d5dc37f713e8aa031581b4)
man/systemd.exec.xml