Subject: Can AppArmor allow stat of a worker's own PID namespace without
 granting access to namespace handles?
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

Hello AppArmor maintainers,

Is there a supported rule or Ubuntu package revision that lets a confined
wor=
ker follow /proc/1/ns/pid and obtain the device and inode of its own PID
name=
space, while keeping the existing restrictions on opening namespace handles
a=
nd accessing other namespaces?

The worker is PID 1 in a private PID namespace. It runs under a dynamic,
unpr=
ivileged UID, with empty capability sets and NoNewPrivs. Its mount view
conta=
ins a read-only root and procfs. Its chroot_relative profile already
includes=
 the rule "/proc/1/ns/{mnt,pid} r,". The Ubuntu kernel is 7.0.0-43-generic
(v=
ersion signature 7.0.0-43.43~24.04.1-generic 7.0.14). The AppArmor
userspace =
package is 4.0.1really4.0.1-0ubuntu0.24.04.7.

In an isolated CPU-only test, the single-threaded worker called
os.stat('/pro=
c/1/ns/pid') once and received EACCES. The only matching audit event for
the =
worker PID and profile had these fields:

    operation=3D"getattr" info=3D"Failed name lookup - disconnected path"
nam=
e=3D"" error=3D-13

Its timestamp overlapped the call on the measured coarse clock. The audit
eve=
nt did not identify the inode. Before and after the call, the host
independen=
tly obtained the same st_dev and st_ino for the live worker's PID namespace.

We would like the worker's own stat through the original procfs link to
retur=
n those values while preserving the existing file and IPC confinement. If a
s=
upported revision addresses this case, which source commit or Ubuntu
package =
provides it? Which operations and objects would it authorize?

Thank you.

Reply via email to