Repository navigation
Description
Description
On kernel 6.17 with AppArmor profile stacking enabled, processes created via CRI ExecSync (kubectl exec, exec-based liveness/readiness probes) run under a stacked profile cri-containerd.apparmor.d//&unconfined instead of plain cri-containerd.apparmor.d.
The signal rule from the AppArmor template (signal (send,receive) peer={{.Name}}) expands to peer=cri-containerd.apparmor.d which does not match the stacked peer name, causing DENIED audit events for SIGURG (Go runtime goroutine preemption).
The abi <abi/3.0> pin from #12864 is already on main and does not fix this issue.
Related to #12726 (same root cause: AppArmor behavior changes on kernel 6.17), different symptom.
Steps to reproduce the issue
- Run containerd on kernel 6.17+ with AppArmor stacking enabled (
/sys/kernel/security/apparmor/features/domain/stack=yes) - Start any container under the default
cri-containerd.apparmor.dprofile - Compare AppArmor profiles of PID 1 vs an exec'd process:
$ kubectl exec <pod> -- cat /proc/1/attr/apparmor/current
cri-containerd.apparmor.d (enforce)
$ kubectl exec <pod> -- cat /proc/self/attr/apparmor/current
cri-containerd.apparmor.d//&unconfined (enforce)
- If the container has an exec probe that runs a Go binary (Go 1.14+, which uses SIGURG for goroutine preemption), observe AppArmor DENIED entries in
dmesg
Tested on two different containers (OpenBao and Authelia) — both show the same profile divergence between PID 1 and exec'd processes.
Describe the results you received and expected
Received: exec'd processes get stacked profile cri-containerd.apparmor.d//&unconfined, and signal self-delivery is denied:
audit: type=1400 apparmor="DENIED" operation="signal" class="signal" profile="cri-containerd.apparmor.d" pid=1814255 comm="bao" requested_mask="send" denied_mask="send" signal=urg peer="cri-containerd.apparmor.d//&unconfined"
The main container process (PID 1) sends SIGURG successfully (verified with strace --trace=tgkill, returns 0). Only exec'd processes trigger denials.
Expected: exec'd processes should have the same effective profile as PID 1. Signal self-delivery within the same container should not be denied.
Verified fix
Adding one line to the AppArmor template in contrib/apparmor/template.go fixes the issue:
# Container processes may send signals amongst themselves.
signal (send,receive) peer={{.Name}},
+ # In stacking mode (kernel 6.7+), exec'd processes get a stacked profile.
+ signal (send,receive) peer={{.Name}}//&*,Tested by manually loading the modified profile with apparmor_parser --replace. After loading, zero new DENIED entries over 56+ seconds (11+ probe cycles at 5s interval), whereas before the fix there were continuous denials every probe cycle.
Note: the same stacking issue likely affects the ptrace rule as well:
ptrace (trace,tracedby,read,readby) peer={{.Name}},
What version of containerd are you using?
containerd github.com/k3s-io/containerd/v2 v2.1.5-k3s1
Any other relevant information
$ uname -a
Linux k8s-cp-01 6.17.0-1007-raspi #7-Ubuntu SMP PREEMPT_DYNAMIC aarch64 GNU/Linux
$ apparmor_parser --version
AppArmor parser version 5.0.0~alpha1
$ cat /sys/kernel/security/apparmor/features/domain/stack
yes
OS: Ubuntu 25.10 (questing), aarch64
Why only some containers are visibly affected: the issue affects ALL containers (confirmed on OpenBao and Authelia), but only manifests as dmesg spam when a container has an exec probe that spawns a Go binary. Long-running container processes (PID 1) are not affected because they run under the non-stacked profile.
Workaround: set AppArmor profile to Unconfined on affected pods via pod annotation.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
apparmor: add signal and ptrace rules for stacked profiles
apparmor: add signal and ptrace rules for stacked profiles
achernya commentedon Feb 14, 2026
I can't reproduce this behavior with the same test harness in which I tested #12864 with the abi/3.0 fix applied.
I also had
dmesg -H -Wrunning in another tab while doing this testing and got no dmesg spam.lexfrei commentedon Feb 15, 2026
@achernya I think the key difference is the AppArmor userspace version, not the kernel itself.
Your setup:
apparmor 4.1.1-pmx1(Proxmox)My setup:
apparmor_parser 5.0.0~alpha1(Ubuntu 25.10 questing)Both have
domain/stack = yesand kernel 6.17, yetkubectl execproduces different profiles:cri-containerd.apparmor.d (enforce)(no stacking)cri-containerd.apparmor.d//&unconfined (enforce)(stacked)This suggests that
apparmor_parser 5.0.0~alpha1either compiles the profile differently or changes the default exec transition behavior when stacking is available. The kernel honorsdomain/stackin both cases, but the compiled policy from 5.0.0 results inunconfinedbeing stacked on top during exec.Could you check with
apparmor_parser 5.0.0~alpha1(or any 5.x) to confirm this is the discriminating factor?Either way, I'd argue the fix is still worthwhile — the
signal peer={{.Name}}//&*rule makes the profile robust against stacking regardless of which parser version produced it. As distros ship AppArmor 5.x (Ubuntu 25.10 already does), this will affect more users.feat(k3s): add toggle to disable cri-containerd AppArmor profile (#88)
marnixbouhuis commentedon Jun 10, 2026
Similar issue gets triggered over here running Ubuntu 26.04 LTS.
apparmor: add signal and ptrace rules for stacked profiles
DvdChe commentedon Jul 9, 2026
Confirming this on containerd 2.3.1 — the abi/3.0 pin from #12864 does not fix the signal variant, and the impact goes beyond SIGURG audit noise.
Environment:
Observed: processes created via CRI exec (kubectl exec, ExecSync) run under the stacked label, while container-init descendants keep the plain profile:
Any signal between two exec-spawned processes is denied — including a process signaling its own child:
Signals from exec-spawned processes to init-descendants are allowed, which keeps the bug invisible in day-to-day use.
Real-world impact beyond SIGURG noise: this breaks PostgreSQL major version upgrades managed by zalando/postgres-operator on Spilo/Patroni clusters. The operator (and the documented manual procedure) runs pg_upgrade via the exec API; pg_upgrade starts a temporary postmaster and then fails to stop it:
so the upgrade aborts after all checks pass, and rolls back — on every attempt, including the operator's automated maintenance-window upgrades. It also silently breaks timeout(1) killing its children inside exec sessions (leaked processes), and presumably ptrace-based debugging (strace -p on exec-spawned processes) per the peer rules having the same shape.
Workaround we used: run the upgrade script from a lineage rooted in container init instead of exec — a one-shot root crontab inside the pod (spilo ships a cron daemon under runit). Jobs spawned by cron get the plain cri-containerd.apparmor.d label and signaling works. Pre-loading a patched cri-containerd.apparmor.d profile on nodes (so containerd skips generating its own) also works as a fleet-wide mitigation.
Since 2.3.1 already carries the abi pin, this confirms the pin only addresses the unix-socket mediation (#12726) — the peer= label matching for signals still fails against stacked labels. The stacked-peer rules in #12887 are the right direction; based on our testing, receive is affected as well as send, so covering both would be safer.
apparmor: add signal and ptrace rules for stacked profiles
apparmor: add signal and ptrace rules for stacked profiles
apparmor: add signal and ptrace rules for stacked profiles
apparmor: add signal and ptrace rules for stacked profiles
apparmor: add signal and ptrace rules for stacked profiles
apparmor: add signal and ptrace rules for stacked profiles
bug: on Ubuntu 26.04, TimescaleDB, Hasura and ingress-nginx can signa…
adelton commentedon Oct 31, 2026
Any chance of getting either #12887 or #13905 reviewed and merged in some form?
This bug seems to block various K8s deployments on recent kernels (namely Ubuntu 26.04), judging by the number of issues that refer back here.
fix(ci): isolate full scenarios and wait for Postgres bootstrap (#3)
cnpg: Fix apparmor after Ubuntu 26.04 upgrade
sec: Document apparmor problems on Ubuntu 26.04
adelton commentedon Nov 22, 2026
Is this now a duplicate of https://github.com/containerd/containerd/issues/14485 which was resolved via https://github.com/containerd/containerd/pull/14487?
Or is https://github.com/containerd/containerd/pull/12887 still relevant and needed as well?