diff options
| author | Georgia Garcia <georgia.garcia@canonical.com> | 2026-10-14 19:08:21 -0300 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-10-29 10:44:18 -0700 |
| commit | ce94927fa4173fcc1eca27bdc65a140064c8f1e6 (patch) | |
| tree | df2b9124c5d9e610649dcbf9f3b56d6f7af62562 /scripts/Makefile.thinlto | |
| parent | 97ba44a2aa4c7ab011a93ce94cb595200fe4ea4f (diff) | |
| download | linux-ce94927fa4173fcc1eca27bdc65a140064c8f1e6.tar.gz linux-ce94927fa4173fcc1eca27bdc65a140064c8f1e6.zip | |
apparmor: fix profile leak when a policy load fails
The error paths of aa_replace_profiles() and aa_unpack() do not break
the refcount cycle between label and proxy. They just aa_put_profile()
the new profiles, which drops the label refcount from 2 to 1, and the
proxy keeps the profile alive. Every failed atomic policy load
(e.g. "profile can not be replaced", or a later profile in the blob
failing to unpack) leaks every new profile in the set, along with its
proxy, rules and its loaddata reference.
The leak is usually not visible from userspace, because the raw_data
directory for a failed load is not created, but it becomes visible
when the blob is deduplicated onto an existing loaddata, which then
keeps its policy/raw_data/<rev> directory forever.
Add aa_put_unpublished_profile(), which drops the profile's own proxy
before putting the profile, and use it on those error paths. The
proxy of an unpacked profile is always freshly allocated and not
referenced by anything else before the profile is published, so
putting it is safe.
Fixes: 637f688dc3dc ("apparmor: switch from profiles to using labels on contexts")
Cc: stable@vger.kernel.org
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
