Skip to content

Default AppArmor profile denies signals inside a container when the label is stacked (//&unconfined, Ubuntu apparmor_restrict_unprivileged_unconfined=1) #14485

Closed

Description

@omwamij

Description

On Ubuntu hosts with kernel.apparmor_restrict_unprivileged_unconfined=1 (the default, from /usr/lib/sysctl.d/10-apparmor.conf in Ubuntu's apparmor package), processes in a container confined by containerd's default profile can no longer signal each other.

runc runs unconfined and has no CAP_MAC_OVERRIDE, so its change_onexec to the container profile is converted to a stack:

apparmor="AUDIT" operation="change_onexec" info="change_profile unprivileged unconfined converted to stacking" comm="runc:[2:INIT]" target="cri-containerd.apparmor.d//&unconfined"

The container's tasks then carry the label cri-containerd.apparmor.d//&unconfined. The default template only allows the literal name:

signal (send,receive) peer={{.Name}},
ptrace (trace,tracedby,read,readby) peer={{.Name}},

so signals between a container's own processes are denied:

apparmor="DENIED" operation="signal" profile="cri-containerd.apparmor.d" comm="postgres" requested_mask="send" signal=urg peer="cri-containerd.apparmor.d//&unconfined"

PostgreSQL fails with could not signal for checkpoint: Permission denied and does not come back.

On kernel 7.0.0-38 the stacking was already logged but rarely led to denials. On 7.0.0-42 it applies to every non-privileged container.

Steps to reproduce

Without Kubernetes, using the default profile loaded on the host:

setpriv --reuid 65534 --regid 65534 --clear-groups \
  aa-exec -p cri-containerd.apparmor.d -- sh -c 'sleep 30 & kill -URG $!'
# kill: Permission denied

Seen in practice with Ubuntu 26.04, kernel 7.0.0-42-generic, k3s v1.36.5+k3s1 (containerd v2.3.4), and PostgreSQL (CloudNativePG).

Proposed fix

Allow the stacked form of the same peer in contrib/apparmor/template.go, and nothing wider:

signal (send,receive) peer={{.Name}}//&unconfined,
ptrace (trace,tracedby,read,readby) peer={{.Name}}//&unconfined,

containerd main still has only peer={{.Name}}. moby's default profile template has the same rule.

Workarounds

  • Load a host copy of the profile with the two rules above before containerd starts. LoadDefaultProfile skips loading when a profile of that name is already loaded, so the host copy is used. Tested: 0 denials, PostgreSQL healthy.
  • Set kernel.apparmor_restrict_unprivileged_unconfined=0. This weakens host hardening.

A user hit the same pattern with Incus on Ubuntu 25.04: https://discuss.linuxcontainers.org/t/apparmor-blocks-sending-signals-on-ubuntu-25-04-host/23962

Activity

  1. jonyhy96 commented on Oct 29, 2026

    @jonyhy96
    Contributor

    The default profile only allows signal and ptrace for the literal profile name. After Ubuntu stacks //&unconfined onto that name, processes in the same container cannot signal each other.

    #14487 adds {{.Name}}//&* for those two rules, with the same permissions the unstacked name already has.

  2. kwehden commented on Nov 4, 2026

    @kwehden

    This needs a supported fix and clear operator guidance. We have now lost real SkyPilot provisioning to this defect on multiple Ubuntu 26.04 Kubernetes workers. Pods report Ready, runtime files arrive intact, and the launch hangs indefinitely because rsync cannot signal its own processes. A security update should not leave operators discovering a broken process lifecycle through stalled production work.

    We had already repaired other workers after earlier incidents. The unrepaired workers failed again. That incomplete fleet rollout is our responsibility; the incompatible default runtime policy and lack of a released correction remain the upstream problem.

    Evidence from November 3, 2026

    • Ubuntu 26.04.1 LTS, amd64, kernel 7.0.0-42-generic, AppArmor 5.0.2-0ubuntu1~26.04.1, K3s containerd v2.3.2-k3s2.
    • kernel.apparmor_restrict_unprivileged_unconfined=1, supplied by the installed Ubuntu apparmor package in /usr/lib/sysctl.d/10-apparmor.conf.
    • The kernel logs runc's transition being converted to cri-containerd.apparmor.d//&unconfined, then this denial at the stalled rsync timestamp:
    apparmor="DENIED" operation="signal" class="signal"
    profile="cri-containerd.apparmor.d" comm="rsync"
    requested_mask="send" denied_mask="send" signal=usr2
    peer="cri-containerd.apparmor.d//&unconfined"
    

    Controlled SkyPilot CPU launches used the same container image and 2 CPUs / 4 GB RAM. A 20 GB ephemeral-storage request and a matched launch without that request both stalled on the same uncorrected worker. The 20 GB launch also stalled on a second worker. On a worker with the existing narrow stacked-peer signal correction, the full 20 GB launch completed, verified its uploaded input hash, wrote and fsynced a 16 MiB temporary file, and exited successfully. All 11 runtime files matched their source hashes on one stalled allocation, so transfer progress at 100% was actively misleading. SSH directly to the allocated test pod reproduced the hang too; bypassing kubectl port-forward did not resolve it.

    The correction in that successful control is only:

    signal (send,receive) peer="cri-containerd.apparmor.d//&unconfined",
    

    AppArmor remains enforcing. We did not disable the host restriction, use an unconfined test pod, or turn a timeout into success. This is a cross-host control, not a same-host before/after proof or a kernel bisection. Earlier confined signal and local-rsync acceptance also passed on the repaired workers.

    Provenance and requested action

    Ubuntu's installed package changelog records enabling the sysctl in apparmor 4.1.0~beta4-0ubuntu1 on February 11, 2025. The later kernel fix 08c2f7c8d4b, tracked as CVE-2026-90231, changes forced-stack enforcement. Ubuntu's 7.0.0-42.42 source changelog includes it under 7.0.0-41.41 / LP #2169638. Our affected worker installed 7.0.0-42.42 on October 28. Ubuntu reports LP #2172640 and LP #2172746 describe the same regression family. We have not independently bisected that commit.

    The security fix addresses a real vulnerability. Keeping that protection must be compatible with ordinary container process signaling. This failure family was already reported in #12886 in February, and #14487 is still open.

    Please provide a reviewed fix, a supported-release backport plan, and coordinated guidance with Ubuntu/K3s. Regression coverage needs to exercise container init and CRI-exec descendants, own-child SIGUSR2/SIGURG/SIGTERM/SIGKILL delivery, real rsync completion, and termination cleanup with Ubuntu's default restriction enabled. Please also document the exact fixed versions and a narrowly scoped interim policy. Operators should not have to choose between weakening confinement and silently stalled workloads.

  3. kwehden commented on Nov 4, 2026

    @kwehden

    Thank you for working on this. Following up on our earlier report with the completed rollout results and the operational impact.

    We have now completed remediation and runtime validation across nine x86 Kubernetes hosts. The accepted run included ten CPU-only SkyPilot allocations: two on the initial canary host and one on each remaining host. All completed runtime-file synchronization, real rsync, non-root signal and own-child inspection checks, and a temporary-storage write. All test allocations were removed. Post-apply acceptance windows contained zero CRI-profile denials, and our workload operators have confirmed that normal operation is restored.

    The policy change was limited to these exact peers:

    signal (send,receive) peer="cri-containerd.apparmor.d//&unconfined",
    ptrace (trace,tracedby,read,readby) peer="cri-containerd.apparmor.d//&unconfined",
    

    AppArmor remains enforcing, the Ubuntu restriction remains enabled, and the baseline denies were preserved. We used the exact observed stacked identity rather than a wildcard. This expands the shipped profile's explicit peer allowlist to restore its intended same-profile behavior. Functional success alone does not establish security equivalence, which is why a maintainer-reviewed correction and supported backports matter to us.

    The impact extended beyond a failed test. Normal provisioning stalled even though pods were Ready and transferred files were intact. We also observed PostgreSQL SIGURG denials on an affected host before its policy replacement. Recovery required fleet-wide investigation, policy review, protected rollback material, behavioral testing and additional monitoring. Operators now have a local security-policy exception to maintain across future kernel and runtime updates.

    We understand that the kernel change addresses a real confinement escape. Our concern is the compatibility gap between that change and the default runtime profile. We have not performed a kernel bisection and are not claiming that the precise first-bad commit has been independently established on our fleet.

    Could the kernel/AppArmor, Ubuntu and container-runtime maintainers coordinate a supported correction, backport guidance and regression coverage for ordinary container process operations with Ubuntu's default restriction enabled? Testing both managed-job and CRI-exec paths, including real rsync completion and process cleanup, would have exposed the failure we encountered. Clear affected/fixed-version guidance and a reviewed interim policy would also reduce the need for operators to make security-policy decisions while restoring service.

    We appreciate the security intent and the work involved. Please retain this as an operator-impact report when assessing the rollout and compatibility testing for this class of change.

  4. tboerger commented on Nov 4, 2026

    @tboerger

    Here is another investigation I have done with the help of Claude in Kubernetes context where an kernel update led to a broken Postgres and .NET runtime:

    Summary

    On nodes running Ubuntu 26.04.1 with kernel 7.0.0-42-generic, AppArmor denies
    signal operations between processes (and threads) of the same container.
    The kernel audit log shows the container's profile cri-containerd.apparmor.d
    being denied sending signals to a peer labelled
    cri-containerd.apparmor.d//&unconfined. Identical pods on
    7.0.0-38-generic nodes were unaffected.

    This is the same mechanism already reported for the .NET runtime (see "Related
    reports"). PostgreSQL is a second, independent workload hit by it: Postgres
    relies on inter-process signals (SIGURG latch wake-ups, SIGUSR1 postmaster
    requests, checkpoint requests). With signals denied, a hot standby never
    starts its walreceiver and never becomes ready.

    Setting securityContext.appArmorProfile.type: Unconfined on the pod fixed it
    (see evidence 7), which isolates the cause to the AppArmor profile.

    Environment

    OS Ubuntu 26.04.1 LTS
    Kernel, affected 7.0.0-42-generic
    Kernel, unaffected 7.0.0-38-generic
    Container runtime containerd 2.3.5
    Kubernetes v1.36.x
    Workload CloudNativePG 1.30.1, PostgreSQL 16.15 (ghcr.io/cloudnative-pg/postgresql:16)
    Pod security PodSecurity baseline (forbids AppArmor Unconfined until the namespace is set to privileged)

    Nodes were updated and rebooted onto -42 in a rolling fashion starting
    2026-10-30 (about 06:26 UTC), so clusters temporarily ran a mix of both kernels.

    Evidence

    1. Perfect correlation with the node kernel. Across three clusters, all 4
    stuck standbys ran on -42 nodes; all 8 healthy PostgreSQL pods ran on -38
    nodes.

    2. Kernel audit log on a -42 node (dmesg), several times per second:

    audit: type=1400 apparmor="DENIED" operation="signal" class="signal"
      profile="cri-containerd.apparmor.d" pid=<postmaster> comm="postgres"
      requested_mask="send" denied_mask="send" signal=urg
      peer="cri-containerd.apparmor.d//&unconfined"
    

    3. Process labels (/proc/<pid>/attr/current) of the affected postgres
    processes: cri-containerd.apparmor.d//&unconfined (enforce), i.e. a stacked
    label. The sending process is labelled plain cri-containerd.apparmor.d.
    uid 26 (non-root), no capabilities, NoNewPrivs: 1, Seccomp: 2.

    4. strace of the postmaster (from a privileged node debug pod):

    kill(21, SIGURG) = -1 EACCES (Permission denied)    # after every SIGCHLD
    

    PID 21 is the postmaster itself, i.e. it cannot even wake its own event loop.

    5. PostgreSQL log on the standby:
    could not signal for checkpoint: Permission denied.

    6. Standby behaviour. The startup process sits in epoll_wait(..., -1)
    forever: no walreceiver, no archive polling. A SIGHUP sent to the startup
    process from the node wakes it and lets it replay archived WAL, which shows

    the process itself is healthy and only lacks wake-ups.

    7. The fix works. After allowing Unconfined and recreating the pods, the
    stuck standbys came up 2/2 and streamed within about 40 seconds on all
    affected clusters. No other change was needed.

    Reproduction

    1. Run any PostgreSQL standby (e.g. a CloudNativePG replica) on a 7.0.0-42 node.
    2. Observe the pod at 1/2, FATAL: the database system is starting up, no
      walreceiver process.
    3. dmesg | grep 'apparmor.*DENIED.*signal' on the node.

    The same pod on a 7.0.0-38 node starts and streams normally.

    What I have not verified

    • Whether pods on -38 nodes carry the plain label or the same stacked label
      (compare /proc/<pid>/attr/current on a healthy pod).
    • What exactly changed between -38 and -42: kernel AppArmor stacking
      behaviour, the profile text generated by containerd, or both.
    • Whether other multi-process workloads on -42 nodes are affected beyond
      PostgreSQL and .NET.

    Related reports (same mechanism, other workloads)

    Impact

    • Standbys stay un-ready on every node booted onto -42; clusters run degraded.
    • A stuck standby's inactive replication slot retains WAL on the primary and
      can fill its volume (this caused a database outage here).
    • Not fixable per pod under PodSecurity baseline, which forbids Unconfined;
      the workaround requires relaxing the namespace to privileged.

    Workarounds

    • securityContext.appArmorProfile.type: Unconfined on the affected pods
      (needs PodSecurity privileged on the namespace).
    • Keep affected pods on -38 nodes, or pin/roll back the kernel to 7.0.0-38.

    Questions for maintainers

    1. Is the stacked label cri-containerd.apparmor.d//&unconfined expected for
      containers on this kernel, and should the default profile's signal rules
      match it?
    2. Was there a change in AppArmor signal mediation or profile stacking
      between 7.0.0-38 and 7.0.0-42?
    3. Is there a supported fix (containerd/runc version, profile update, kernel
      setting) other than disabling AppArmor confinement per pod?

    Red herring (for anyone searching)

    The symptom looks like cloudnative-pg/cloudnative-pg#11762 and #10419 (standby
    stays in archive recovery, no walreceiver, slot inactive). It is not
    caused by CloudNativePG or PostgreSQL: restarts, a full re-clone onto a fresh
    volume, WAL switches and walreceiver timeout changes made no difference. Only
    the node kernel/AppArmor profile did.

  5. davidnich commented on Nov 4, 2026

    @davidnich

    Another data point, narrowing the trigger to the kernel update:

    • Ubuntu 26.04, k3s v1.36.4+k3s1 (containerd v2.3.4-k3s1.36), AppArmor parser 5.0.2, kernel.apparmor_restrict_unprivileged_unconfined=1 and kernel.apparmor_restrict_unprivileged_userns=1 on every node.
    • Nodes still booted on 7.0.0-34-generic: container processes are labelled cri-containerd.apparmor.d (enforce) and signal each other normally.
    • The same node after booting 7.0.0-42-generic (no other change): every container process is labelled cri-containerd.apparmor.d//&unconfined (enforce), and every signal inside a container is denied:
    apparmor="DENIED" operation="signal" class="signal" profile="cri-containerd.apparmor.d" comm="postgres"
      requested_mask="send" denied_mask="send" signal=urg peer="cri-containerd.apparmor.d//&unconfined"
    

    So with identical sysctls and containerd, 7.0.0-34 does not stack the label and 7.0.0-42 does.

    Impact on PostgreSQL 18.6 (CloudNativePG replica after a node reset): the startup process's SendPostmasterSignal() calls (kill(PostmasterPid, SIGUSR1)) and the postmaster's own latch wakeups (kill(getpid(), SIGURG) → EACCES, seen in strace) are all denied. gdb shows PMSignalFlags RECOVERY_STARTED, RECOVERY_CONSISTENT, BEGIN_HOT_STANDBY and START_WALRECEIVER set but never consumed, the postmaster stuck in PM_STARTUP with pending_pm_pmsignal = 0, and no WAL receiver: the replica reaches a consistent state, then waits for WAL forever and refuses connections with "the database system is starting up". Go programs in the same pods (CNPG instance manager, CoreDNS, node_exporter) log the same SIGURG denials but survive.

    Mitigation we applied: boot the previous kernel (GRUB pin) and hold the kernel metapackages until the profile allows stacked peers (#14487).

  6. TincaTibo commented on Nov 6, 2026

    @TincaTibo

    Hi all,

    Reproduction on Ubuntu 26.04 + linux-aws 7.0.0-1016 (k3s): first-party before/after on the same host

    Same symptom as above, with a clean A/B on one host. It also gives a narrower kernel window than "7.0.0-42".

    Environment

    • Ubuntu 26.04.1 LTS, AWS (linux-aws), apparmor 5.0.2-0ubuntu1~26.04.1
    • k3s v1.37.2+k3s1 (embedded containerd, default cri-containerd.apparmor.d profile, loaded in enforce mode)
    • kernel.apparmor_restrict_unprivileged_unconfined=1, kernel.apparmor_restrict_unprivileged_userns=1 (Ubuntu defaults, untouched)

    A/B on the same host, same workloads, same k3s

    Kernel Boots checked operation="signal" DENIED
    7.0.0-1014-aws (Ubuntu 7.0.0-38) ~20 boots, Oct 15 – Nov 6 0
    7.0.0-1016-aws (Ubuntu 7.0.0-41) 1 boot, ~77 min uptime 726

    The first denial was 24 s after boot (metrics-server). Booting back into 1014 made them stop.

    Denial shape (all 726 identical)

    apparmor="DENIED" operation="signal" class="signal"
    profile="cri-containerd.apparmor.d" requested_mask="send" denied_mask="send"
    signal=urg peer="cri-containerd.apparmor.d//&unconfined"
    
    • By signal: urg 678, quit 24, io 23, rtmin 1.
    • Affected comms include Go services (schemas-go, tcp-write-go, web-write-go, controller, …) for SIGURG (Go async preemption), and java for SIGQUIT.
    • Also 84 operation="ptrace" denials (requested_mask="read") with the same //&unconfined peer.

    Kernel window
    This host went 1014 → 1016 (it never ran 1015). The linux-aws changelog shows Ubuntu 7.0.0-39 (1015) and 7.0.0-41 (1016) between them. Two AppArmor entries there look relevant:

    • apparmor: fix unconfined user namespace restriction forced stack (7.0.0-41), matching the CVE-2026-90231 change suspected above
    • apparmor: fix cred UAF caused by begin_current_label_crit_section() (7.0.0-39)

    I haven't bisected, so this only narrows the candidate to the 7.0.0-38 → 7.0.0-41 range, not to one commit.

    Impact observed: none of our pods crashed outright, but every container process hit the denial, so Go loses async preemption and the JVM loses thread dumps. Workloads that depend on signals between container processes (e.g. PostgreSQL) would hang, as reported above.

    This supports the stacked-peer rule in #14487 / the narrower peer={{.Name}}//&unconfined proposal.

  7. ruslanty commented on Nov 8, 2026

    @ruslanty

    Reproduced on Ubuntu 26.04 amd64, kernel 7.0.0-43-generic, K3s v1.37.1+k3s1, MySQL 9.7.4.

    After rebooting into .43, all three MySQL pods remained unready. The inspected entrypoint logs stopped at:

    [Entrypoint]: Switching to dedicated user 'mysql'
    

    The kernel logged repeated denials affecting multiple containers, including CoreDNS, Grafana and Flux controllers. Example, with host identifiers removed:

    apparmor="DENIED" operation="signal" class="signal"
    profile="cri-containerd.apparmor.d" comm="coredns"
    requested_mask="send" denied_mask="send" signal=urg
    peer="cri-containerd.apparmor.d//&unconfined"
    

    Rebooting back into 7.0.0-38-generic restored all three MySQL pods to 1/1 Ready; each logged ready for connections.

    No AppArmor policy changes or proposed patches were applied during this comparison.

  8. added a commit that references this issue on Nov 10, 2026
    22feb06
  9. 3 remaining items

  10. added a commit that references this issue on Nov 13, 2026
    2d2b285
  11. added 2 commits that reference this issue on Nov 16, 2026
    a078d55
    8969e6a
  12. added 3 commits that reference this issue on Nov 16, 2026
    7b7e53d
    09604a8
    23152a3
  13. added a commit that references this issue on Nov 17, 2026
    f4cc0fb
  14. arun-chib commented on Nov 24, 2026

    @arun-chib

    Thanks for the fix. We hit this on Ubuntu 26.04 with kernel 7.0.0-42 and CloudNativePG (Postgres fails with could not signal for checkpoint: Permission denied).

    I can see it's merged to main and backported to release/2.3 (#14590) and release/2.4 (#14591). The latest tags, v2.3.7 and v2.4.2, don't include it.

    Is there a planned date for the next patch release (2.3.8 / 2.4.3)? We'd like to upgrade rather than carry a profile workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions