Also affects me: 7.0.0-43-generic, Ubuntu 26.04.1, snapd 2.78,
prompting-client rev 228. I saw 20 of these WARNINGs and one panic in a
week. It is the same bug as #2172038 and #2173684 (probably duplicates
of this one).
Root cause, as far as I can tell (security/apparmor/notify.c,
knotif_update_from_uresp_perm(), around lines 898-911, tag
Ubuntu-7.0.0-43.43):
insert_in_cache(knotif); /* return value ignored */
INIT_DELAYED_WORK(&node->work, audit_cache_work_function);
schedule_delayed_work(&node->work, secs_to_jiffies(aa_cache_timeout));
If an equivalent entry is already cached, insert_in_cache() returns
false and the node is not cached, but its 5 s timer is armed anyway.
check_user() (file.c) drops its reference as soon as the reply arrives,
so the node is freed via call_rcu(&node->rcu). In struct aa_audit_node,
`rcu` shares a union with `work` (offset 0x100), and rcu_do_batch()
zeroes rhp->func, which is work.entry.next. The timer then fires on
reed memory, which gives the WARNING at workqueue.c:2351 with entry.next
== NULL (as in the #2172038 dumps) and later the GPF in __run_timers.
There is no cancel_delayed_work*() anywhere in security/apparmor;
aa_audit_cache_destroy() also drops nodes without cancelling. The code
is unchanged in -42.42, -44.44 and master-next (2026-11-15).
Reproducer (it triggered on the first attempt). Prompting is enabled and
there is a firefox "home" rule that allows read on ~/Downloads/**
forever:
echo test > /home/<user>/Downloads/x.txt
snap run --shell firefox -c 'for t in 1 2 3; do for i in $(seq 50); do
cat /home/<user>/Downloads/x.txt >/dev/null 2>&1 & done; wait; sleep 1;
done'
About 5 s later, two WARNINGs appear at workqueue.c:2351 with RAX
(work->entry.next) = 0. With trace_event=workqueue:workqueue_queue_work
and traceoff_on_warning, the last trace entry is
function=audit_cache_work_function. A single read does not trigger it.
Suggested fix (untested): only arm the timer if insert_in_cache()
returned true, and cancel it (or let it hold its own reference) before a
cached node can be freed.
Workaround: sudo snap set system experimental.apparmor-prompting=false
Attached: dmesg of both WARNINGs and the workqueue trace excerpt.
** Attachment added: "apparmor-uaf.txt"
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2171189/+attachment/6018268/+files/apparmor-uaf.txt
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2171189
Title:
GPF in __run_timers caused by corrupted apparmor audit_cache
delayed_work (7.0.0-38-generic)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2171189/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs