Improper globbing in rules for /sys/devices PCI paths
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| apparmor (Ubuntu) |
Fix Released
|
Medium
|
Keifer Snedeker | ||
| Jammy |
Fix Committed
|
Medium
|
Unassigned | ||
| Noble |
Fix Committed
|
Medium
|
Unassigned | ||
| Plucky |
Fix Released
|
Medium
|
Unassigned | ||
| Questing |
Fix Released
|
Medium
|
Keifer Snedeker | ||
Bug Description
[ Impact ]
* AppArmor profiles with rules for /sys/devices/ PCI paths using decimal patterns may miss some PCI devices whose PCI domain or bus starts with or contains hex characters a-f.
* Example: On a DGX-2 with 10 nvme drives provisioned with Plucky, the output of lsblk is missing entries for nvme2 (pci0000:ae), nvme3 (pci0000:ae), nvme8 (pci0000:d7), and nvme9 (pci0000:d7), and there are apparmor="DENIED" messages for each omitted drive.
* This was addressed by updating any profile containing rule(s) for /sys/devices/ PCI domain:bus paths to use hex matching instead of dec. The alias `@{pci_
[ Test Plan ]
* On a test device provisioned with Plucky which has one or more block devices on PCI whose PCI domain or bus begins with a hex character a-f (e.g., a device with many NVME drives), invoke `lsblk` and compare the output to what is expected for the hardware physically present on the device (or temporarily disable AppArmor and compare the output of `lsblk`).
After installing the proposed packages, invoke `lsblk` again, and compare the listed block devices (none should be missing in this case). Note that this example is specific to Plucky as the lsblk profile was not present in releases prior.
* As many of these profiles are related to software associated with a specific set of hardware, I am unable to manually test the changes across all affected profiles. However, since the changes are uniform across the affected profiles, the implications of a `@{sys}
[ Where problems could occur ]
* Improper matching of /sys/devices/ PCI paths may result in devices being 'invisible' to the software for which the profile(s) regulate (such is the case prior to this patch).
* As far as I'm aware, any PCI bus:domain listed in /sys/devices/ is strictly in the format pciHHHH:HH (where 'H' are hex chars [0-9a-f]). If there are *any* exceptions to this which I'm unaware of, devices on these bus:domains may be omitted by these rules.
[ Other Info ]
Upstream MR (merged): https:/
[1] https:/
[2] https:/
[3] https:/
[ Verbose Example with `lsblk` ]
Expected to see all nvmeXn1 (0-9) devices listed, but some are omitted, such as nvme2n1. nvme2n1 appears under the PCI directory pci0000:ae, thus AppArmor denials appear in dmesg and nvme2n1 is omitted from the output of lsblk (the same applies for the other ommitted devices: nvme3n1, nvme5n1, nvme7n1).
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 29.3G 0 disk
└─sda1 8:1 1 29.3G 0 part
sdb 8:16 1 0B 0 disk
sr0 11:0 1 1024M 0 rom
nvme1n1 259:0 0 894.3G 0 disk
├─nvme1n1p1 259:2 0 512M 0 part /boot/efi
└─nvme1n1p2 259:3 0 893.8G 0 part /
nvme0n1 259:1 0 894.3G 0 disk
nvme4n1 259:4 0 3.5T 0 disk
nvme9n1 259:6 0 3.5T 0 disk
nvme8n1 259:8 0 3.5T 0 disk
nvme6n1 259:11 0 3.5T 0 disk
$ readlink -f /sys/class/
/sys/devices/
$ sudo dmesg | grep -i nvme
...
[11748.808896] audit: type=1400 audit(175046569
[11748.808904] audit: type=1400 audit(175046569
[11748.808931] audit: type=1400 audit(175046569
Related branches
- Lena Voytek (community): Approve
- Benjamin Drung (community): Needs Fixing
- Ubuntu Sponsors: Pending requested
-
Diff: 287 lines (+254/-0)4 files modifieddebian/apparmor.install (+1/-0)
debian/changelog (+6/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/profiles-pci-hex-mr-1725.patch (+246/-0)
- Lena Voytek (community): Approve
- Benjamin Drung (community): Needs Fixing
- Ubuntu Sponsors: Pending requested
-
Diff: 345 lines (+312/-0)4 files modifieddebian/apparmor.install (+1/-0)
debian/changelog (+6/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/profiles-pci-hex-mr-1725.patch (+304/-0)
- Lukas Märdian (community): Abstain
- Lena Voytek (community): Approve
-
Diff: 270 lines (+248/-0)3 files modifieddebian/changelog (+6/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/profiles_pci_hex_mr_1725.patch (+241/-0)
| summary: |
- Improper matching for hex PCI BDFs in lsblk profile + Improper globbing in rules for /sys/devices PCI paths |
| description: | updated |
| no longer affects: | apparmor (Ubuntu Questing) |
| Changed in apparmor (Ubuntu): | |
| importance: | Undecided → Medium |
| Changed in apparmor (Ubuntu Jammy): | |
| importance: | Undecided → Medium |
| Changed in apparmor (Ubuntu Noble): | |
| importance: | Undecided → Medium |
| Changed in apparmor (Ubuntu Plucky): | |
| importance: | Undecided → Medium |
| Changed in apparmor (Ubuntu): | |
| assignee: | nobody → Keifer Snedeker (ks0) |
| Changed in apparmor (Ubuntu Questing): | |
| status: | New → Fix Released |

Jammy and Noble do not have an lsblk profile, but they do have PCI based rules and abstractions that have the same issue.