diff options
| author | John Johansen <john.johansen@canonical.com> | 2026-02-24 10:20:02 -0800 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-03-09 16:05:44 -0700 |
| commit | a0b7091c4de45a7325c8780e6934a894f92ac86b (patch) | |
| tree | ca6aeb988d078924c277f8def6cf2a695c74211a /tools/lib/python/kdoc/python_version.py | |
| parent | 39440b137546a3aa383cfdabc605fb73811b6093 (diff) | |
| download | linux-a0b7091c4de45a7325c8780e6934a894f92ac86b.tar.gz linux-a0b7091c4de45a7325c8780e6934a894f92ac86b.zip | |
apparmor: fix race on rawdata dereference
There is a race condition that leads to a use-after-free situation:
because the rawdata inodes are not refcounted, an attacker can start
open()ing one of the rawdata files, and at the same time remove the
last reference to this rawdata (by removing the corresponding profile,
for example), which frees its struct aa_loaddata; as a result, when
seq_rawdata_open() is reached, i_private is a dangling pointer and
freed memory is accessed.
The rawdata inodes weren't refcounted to avoid a circular refcount and
were supposed to be held by the profile rawdata reference. However
during profile removal there is a window where the vfs and profile
destruction race, resulting in the use after free.
Fix this by moving to a double refcount scheme. Where the profile
refcount on rawdata is used to break the circular dependency. Allowing
for freeing of the rawdata once all inode references to the rawdata
are put.
Fixes: 5d5182cae401 ("apparmor: move to per loaddata files, instead of replicating in profiles")
Reported-by: Qualys Security Advisory <qsa@qualys.com>
Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>
Reviewed-by: Maxime Bélair <maxime.belair@canonical.com>
Reviewed-by: Cengiz Can <cengiz.can@canonical.com>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
