This change regressed my apparmor profile for a script I'm working on,
which walks over processes using python3-psutil, in bionic.

I have this config in the apparmor profile:

  capability sys_ptrace,
  ptrace trace,

With kernel 4.15.0-154-generic #161 it works.

With kernel 4.15.0-158-generic #166 I get a DENIED error and the script
backtraces when reading, for example, /proc/<pid>/fd/0 of some process,
with os.readlink():

[   19.223703] audit: type=1400 audit(1632507704.072:30):
apparmor="DENIED" operation="ptrace" profile="/etc/hostos-
monitoring/plugins.d/process-monitoring" pid=1098 comm="process-monitor"
requested_mask="read" denied_mask="read" peer="unconfined"

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1890848

Title:
  'ptrace trace' needed to readlink() /proc/*/ns/* files on older
  kernels

Status in linux package in Ubuntu:
  Fix Released
Status in linux source package in Xenial:
  Triaged
Status in linux source package in Bionic:
  Fix Released

Bug description:
  SRU Justification:

  [Impact]
  Permission 'ptrace trace' is required to readlink() /proc/*/ns/*, when
  only 'ptrace read' should be required according to 'man namespaces':

  "Permission to dereference or read (readlink(2)) these symbolic links
  is governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check; see
  ptrace(2)."

  [Fix]

  Upstream commit 338d0be437ef10e247a35aed83dbab182cf406a2 fixes ptrace
  read check.

  [Test Plan]

  BugLink contains the source of a binary that reproduces the issue. In
  summary, it executes readlink() on /proc/*/ns/*. There's also a policy
  that has only 'ptrace read' permission. When the bug is fixed,
  execution is allowed.

  [Where problems could occur]

  The regression can be considered as low, since it's lowering the number
  of permissions required. Existing policies that already contain the
  permission 'ptrace trace' and 'ptrace read' will have a broader policy
  than required.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1890848/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to