Denial for /proc/$pid/task/$task/mountinfo when using mount-observe interface

Bug #2053271 reported by Angelos Kolaitis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Committed
Undecided
Philip Meulengracht

Bug Description

----
$ snap version
snap 2.61.1
snapd 2.61.1
series 16
ubuntu 22.04
kernel 6.5.0-17-generic

----

The mount-observe interface allows reading the following files (from https://github.com/snapcore/snapd/blob/master/interfaces/builtin/mount_observe.go#L46):

owner @{PROC}/@{pid}/mounts r,
owner @{PROC}/@{pid}/mountinfo r,
owner @{PROC}/@{pid}/mountstats r,

However, processes might want to retrieve the info from /proc/thread-self/mountinfo instead, which resolves to /proc/$pid/task/$task/mountinfo, e.g. https://github.com/moby/sys/blob/mountinfo/v0.7.1/mountinfo/mountinfo_linux.go#L139-L174

This results in an error message that reads like this:

> open /proc/thread-self/mountinfo: permission denied

And the respective apparmor denial is:

> audit: type=1400 audit(1708025745.628:677): apparmor="DENIED" operation="open" class="file" profile="snap.k8s.k8sd" name="/proc/1751/task/3006/mountinfo" pid=230818 comm="k8sd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

----

We are able to fix the issue by adding the following line to the profile:

owner @{PROC}/@{pid}/task/@{tid}/mountinfo r,

We would like to extend the mount-observe profile to include this line if possible

description: updated
Revision history for this message
Philip Meulengracht (the-meulengracht) wrote :
Changed in snapd:
assignee: nobody → Philip Meulengracht (the-meulengracht)
status: New → In Progress
Revision history for this message
Philip Meulengracht (the-meulengracht) wrote :

This will be fixed for 2.62, as I don't think we have a 2.61.3 scheduled.

Changed in snapd:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.