Upstream and Ubuntu kernels

which kernel does what for everyone for application developers for administrators for security researchers

The profile language is the same everywhere but kernels differ in what they enforce. Mainline Linux has no message queue mediation and does not check addresses or ports and has no prompt listener. Ubuntu kernels carry patches for all three and restrict unprivileged user namespaces. This deck shows each difference on running kernels and then lists release by release what each Ubuntu kernel adds and what mainline has taken over.

On the map: start here

▶ Watch this deck — 10 scenes, ~8 min

Worth seeing first

Part of journeys

01 One profile, two kernels

UPSTREAM AND UBUNTU one profile, twelve rules, abi <abi/5.0>, kernel 7.3 built from mainline 24 rule lines mqueue type=posix rules not enforced kernel 7.3 from Ubuntu 67 rule lines nothing left out exit status 0 on both, and no message unless you ask for warnings message queues addresses and ports user namespaces prompting then release by release: what each Ubuntu kernel adds, what mainline has picked up
One profile with twelve rules and abi 5.0 is compiled for two kernels of version 7.3. On the mainline-based kernel, 24 rule lines come out and mqueue rules are not enforced. On Ubuntu's kernel, 67 rule lines come out and nothing is left out. The deck covers message queues, addresses and ports, user namespaces and prompting, and then goes release by release.

The same profile compiles to 24 rules on a mainline-based kernel 7.3 and to 67 on Ubuntu's kernel 7.3. Ubuntu kernels carry AppArmor patches that mainline does not have.

Take one profile with twelve rules, and compile it for two kernels of the same version, 7.3. On the first, twenty-four rules come out, and one kind is left out. On the second, sixty-seven, and nothing is left out. No error either time. The first kernel is built from mainline Linux. The second is Ubuntu's, which carries its own AppArmor patches. So the profile language is the same everywhere, but what's enforced depends on the kernel. This deck shows the differences: message queues, addresses and ports, user namespaces and prompting. Then it goes release by release through what each Ubuntu kernel adds, and what mainline has picked up.

Details and sources

Details

  • Run in two guests. The mainline-based kernel is Debian sid's 7.3.4, whose 49 feature files are exactly the entries of the feature tables of mainline 7.3. Ubuntu's is 7.3.0-10 of Ubuntu 26.10. The profile was compiled in each guest by the parser of the AppArmor tree the map describes (-Q, features of the running kernel).
  • The profile has one rule of each kind: a file rule, capability net_bind_service,, network inet stream,, network inet tcp ip=127.0.0.1 port=8080,, unix (connect) type=stream peer=(addr=@demo),, dbus send bus=session path=/org/demo,, signal send set=hup,, ptrace read,, mount fstype=tmpfs -> /mnt/demo/,, mqueue (create) type=posix /demo,, userns,, io_uring sqpoll,.
  • "Rule lines" are the rule: lines of -D rule-exprs: 24 on Debian sid, 67 on Ubuntu 26.10. The numbers are not "rules enforced": one rule of the profile can compile to many lines, and the address and port conditions and unix rules compile to more lines where the kernel can check more.
  • With --warn=all, Debian sid printed Warning from profile demo-all (demo-all.sd): mqueue type=posix rules not enforced; Ubuntu 26.10 printed nothing. Without --warn=all neither printed anything. Exit status 0 everywhere.
  • The same command on the other guests: Debian 13 (6.12) 19 lines, Ubuntu 24.04 (6.8) 66, Ubuntu 26.04 (7.0) 67.
  • The kernel source the map describes elsewhere is mainline at a later commit than 7.3; its feature tables have the entries of 7.3 and one more, network_v8/sctp, which no rule of this profile needs.
  • How to run this on your own system: Kernel features and the policy ABI.

02 Where the difference shows

THE FEATURE FILES mainline 7.3: 49 files Ubuntu 7.3: the same 49, and 19 more ipc/posix_mqueuemessage queue rules network_v8/af_inetaddresses and ports policy/notify... domain/interruptiblepromptingpolicy/unconfined_restrictions/{userns,io_uring}restricting unconfined programs network_v9_skb/...packet and interface mediationnetwork/af_unix network/af_maskthe old network table each group: a kind of rule, or a behaviour, on Ubuntu's kernels only /sys/kernel/security/apparmor/features
Mainline 7.3 publishes 49 feature files. Ubuntu's 7.3 publishes the same 49 and 19 more, in groups: ipc/posix_mqueue for message queue rules; network_v8/af_inet for addresses and ports; policy/notify and domain/interruptible for prompting; policy/unconfined_restrictions userns and io_uring for restricting unconfined programs; network_v9_skb for packet and interface mediation; network/af_unix and af_mask, the old network table.

Mainline 7.3 publishes 49 feature files; Ubuntu's 7.3 publishes the same 49 and 19 more: message queues, af_inet, prompting, two restrictions, packet mediation and the old network table.

You can see the difference before you load anything. Every kernel publishes what its AppArmor can do, as a directory of feature files. On mainline 7.3 that's forty-nine files. Ubuntu's kernel of the same version has all of those and nineteen more. They fall into groups. An ipc directory, for message queues. An af_inet entry, for addresses and ports. Entries for prompting. Two for restricting unconfined programs. A directory for packet mediation. And the old network table, kept for policy compiled long ago. Each group is a kind of rule, or a behaviour, that exists on Ubuntu's kernels only. The next scenes take them one at a time.

Details and sources

Details

  • Counted in two guests: every file under /sys/kernel/security/apparmor/features, 49 on Debian sid (kernel 7.3.4, equal to the mainline tables) and 68 on Ubuntu 26.10 (7.3.0-10). No file of the first is missing from the second. The lists also match the feature tables in the two kernel sources line for line.
  • The 19: ipc/posix_mqueue; network_v8/af_inet; network/af_mask, network/af_unix; network_v9_skb/af_mask, iface, localout, postroute, rcv_skb, relabel; domain/interruptible, domain/disconnected.ipc; namespaces/userns_create; policy/notify/user, policy/notify_versions/v3, policy/notify_versions/v5, policy/metadata_tagging_version; policy/unconfined_restrictions/io_uring, policy/unconfined_restrictions/userns.
  • domain/disconnected.ipc belongs to message queues (a profile flag for queues reached through a disconnected path); namespaces/userns_create belongs to the user namespace restriction. The slide puts domain/interruptible with prompting because a profile flag of that name lets a prompt wait be interrupted.
  • Outside the feature directory, Ubuntu kernels have the file /sys/kernel/security/apparmor/.notify and six more sysctls: kernel.apparmor_restrict_unprivileged_userns, ..._userns_force, ..._userns_complain, kernel.apparmor_restrict_unprivileged_io_uring, kernel.apparmor_cache_timeout, kernel.apparmor_packet_mediation (seen on Ubuntu 26.04 and 26.10; the first four on 24.04).
  • "The old network table" is the per-family table of AppArmor 2.x policy. Ubuntu kernels still accept it and advertise it as network/; in mainline that class number is marked deprecated (read from the source).
  • A feature file says that the kernel has the code. See the scene "Listed is not the same as enforced".

03 Message queues

MESSAGE QUEUES mqueue (create, open, read, write, delete) type=posix /demo-ok, Ubuntu's kernels mq_open("/demo-ok")ok mq_open("/demo-other")Permission denied apparmor="DENIED" operation="create" class="posix_mqueue" ... name="/demo-other" mainline the parser, when asked for warnings: mqueue type=posix rules not enforced apparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" ... name="demo-ok" mq_open("/demo-ok")Permission denied fine control on one kernel a flat no on the other check: is there a features/ipc directory?
A profile has the rule mqueue (create, open, read, write, delete) type=posix /demo-ok. On Ubuntu's kernels mq_open of /demo-ok succeeds and /demo-other is denied with a record of class posix_mqueue. On mainline-based kernels the parser prints mqueue type=posix rules not enforced, and mq_open of /demo-ok is denied with a record of class file and info Failed name lookup - disconnected path.

Ubuntu kernels enforce mqueue rules. On mainline the rule is left out, and a confined program cannot open a POSIX queue at all: the open is refused as a file with a disconnected path.

First, message queues. A profile can say which POSIX queues a program may create and open. On Ubuntu's kernels that rule is enforced: in our test the queue named in the rule opened, another name was refused, and the record carried the class posix_mqueue. Mainline has no such mediation. The parser leaves the rule out there, quietly. But that doesn't make queues free. On the mainline-based kernels we tried, a confined program couldn't open any queue at all: the kernel sees the queue as a file it can't name, and refuses. So the same profile gives you fine control on one kernel, and a flat no on the other.

Details and sources

Details

  • Run in the guests with a Python program that calls mq_open(NAME, O_CREAT|O_RDWR) under a profile holding the rule on the slide.
  • Ubuntu 24.04, 26.04 and 26.10: /demo-ok opened; /demo-other failed with EACCES and the record apparmor="DENIED" operation="create" class="posix_mqueue" profile="demo-mq" name="/demo-other" pid=... comm="python3" requested="create" denied="create" class="posix_mqueue" fsuid=0 ouid=0 (26.04). Under a profile without any mqueue rule every name was denied with the same kind of record.
  • Debian sid and Debian 13 (mainline-based): the parser printed mqueue type=posix rules not enforced under --warn=all and loaded the profile with exit status 0. Both names failed with EACCES and the record apparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" error=-13 profile="demo-mq" name="demo-ok" pid=... comm="python3" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0.
  • Why a file: POSIX queues are files on a mount inside the kernel that has no path from the program's root. Mainline has no hook that treats them as queues, so the open reaches the file check with a disconnected path. Whether a profile with flags=(attach_disconnected) and a file rule for the resulting name gets around it on such kernels was not run: see The other profile flags and What is not mediated. An mqueue rule does not: the profile on the slide has one.
  • Read from the source: every Ubuntu kernel from 6.8 to 7.3 advertises ipc/posix_mqueue (permissions create read write open delete setattr getattr, and label from 6.17); the patch is first listed in Ubuntu's 6.2 changelog. No mainline version advertises it; the class number exists in mainline and is unused. From 6.14 Ubuntu also has the flag entry domain/disconnected.ipc.
  • No kernel read, Ubuntu or mainline, advertises System V message queues (ipc/sysv_mqueue).
  • Known discrepancy: a POSIX message queue on a kernel without mqueue mediation is refused as a file with a disconnected path.
  • Known discrepancy: the record of Ubuntu's kernels writes class="posix_mqueue" twice, on 24.04 the second time without a space before it.

for AppArmor developers for security researchers

In the code

  • Mainline: the class is defined and no hook uses it (apparmor.h:33); the file check that refuses a disconnected path is in file.c:156-170.
  • Ubuntu (read from the source, tag Ubuntu-7.3.0-10.10): the queue's inode is marked at creation and checks go to aa_mqueue_perm (security/apparmor/ipc.c:209); the feature entry is in security/apparmor/apparmorfs.c.
  • Parser: mqueue.cc:195-218.

04 Addresses and ports

ADDRESSES AND PORTS network inet stream ip=10.9.9.9, then connect from 127.0.0.1 Ubuntu's kernels apparmor="DENIED" operation="connect" ... info="failed local addr match" ... dest=22 mainline connected the condition is dropped, with no warning network inet stream, deny network (connect) inet stream peer=(ip=127.0.0.1 port=25), port 25 refused, port 22 connected port 25 refused, port 22 refused features/network_v8/af_inet is it there? then addresses and ports count
The rule network inet stream ip=10.9.9.9. On Ubuntu's kernel a connect from 127.0.0.1 is denied with info failed local addr match, daddr 127.0.0.1 and dest 22. On mainline the connect succeeds and the parser prints no warning. The rule deny network (connect) inet stream peer=(ip=127.0.0.1 port=25) next to network inet stream: on Ubuntu port 25 is refused and port 22 allowed; on mainline both ports are refused. Check for features/network_v8/af_inet.

ip= and port= are enforced only where the kernel has network_v8/af_inet: Ubuntu kernels since 6.8. On mainline the condition is dropped without a warning, which widens allow and deny rules alike.

Network rules can carry an address and a port. Whether they count depends on one feature entry, af_inet, and only Ubuntu's kernels have it, in every release since 6.8. There, a rule for one local address refused a connection from another, and the record named the destination address and port. On mainline the parser drops the condition and keeps the rest of the rule, with no warning. An allow rule becomes wider than you wrote it. A deny rule becomes wider too: on our mainline-based test kernel, a rule denying one port refused every port. So if a profile depends on addresses or ports, check for af_inet first.

Details and sources

Details

  • Run with the tree's parser in an Ubuntu 26.04 guest (kernel 7.0.0-43) and a Debian sid guest (7.3.4, mainline-based). The test program connects with TCP from 127.0.0.1 to 127.0.0.1 port 22 (a listening server) and port 25 (nothing listens, so a connect that passes the check ends in "Connection refused").
  • network inet stream ip=10.9.9.9, on Ubuntu 26.04: both connects failed with EACCES; the record: apparmor="DENIED" operation="connect" class="net" info="failed local addr match" error=-13 profile="n-localx" pid=... comm="python3" daddr=127.0.0.1 dest=22 family="inet" sock_type="stream" protocol=6 requested="connect" denied="connect". daddr and dest are fields that mainline records do not have. With ip=127.0.0.1 the connects passed.
  • The same profile on Debian sid: port 22 connected, port 25 got "Connection refused"; --warn=all printed nothing when the profile was compiled.
  • network inet stream, with deny network (connect) inet stream peer=(ip=127.0.0.1 port=25),: on Ubuntu 26.04 port 22 connected and port 25 failed with EACCES. On Debian sid both failed with EACCES.
  • Known discrepancy: inet conditionals are dropped silently when the kernel has no af_inet, so deny rules get wider.
  • Recorded earlier with the same harness: network inet ip=1.2.3.4 port=80, refuses a connect on Ubuntu 24.04, 26.04 and 26.10 and lets it through on Debian 13 and Debian sid.
  • Not everything about the conditions was confirmed on Ubuntu. Known discrepancy: an allow rule limited by peer=(ip=... port=...) does not limit connect on Ubuntu 26.04. With network inet stream peer=(ip=127.0.0.1 port=22), a connect to port 25 passed the check. Whether the parser or the kernel is the cause is not determined.
  • Read from the source: network_v8/af_inet is advertised by every Ubuntu kernel from 6.8 to 7.3; the patch arrived with 24.04. No mainline version advertises it. Mainline 7.3 has a file af_inet.c whose checks compare family, type and protocol only; Ubuntu 7.3 replaces about a thousand lines of it. The parser also asks for network_v9/af_inet, which no kernel read has.
  • Interfaces (interface=) need network_v9_skb/iface: Ubuntu 7.0 and 7.3 list it and keep packet mediation switched off (kernel.apparmor_packet_mediation = 0 on both guests). Not run.

for AppArmor developers for security researchers

In the code

05 User namespaces

USER NAMESPACES apparmor="DENIED" operation="userns_create" class="namespace" profile="demo" confined, no userns, rule: denied on all five kernels unprivileged, no profile $ unshare -Ur true profile unprivileged_userns { audit deny capability, ... } Ubuntu: the kernel moves the program into this profile Ubuntu: unshare: write failed /proc/self/uid_map: Operation not permitted Debian: exit status 0 kernel.apparmor_restrict_unprivileged_userns = 1 kernel default 0; set by user space on Ubuntu, a program that needs namespaces needs a profile that says so
A confined program without a userns rule is denied on all five kernels: operation userns_create, class namespace. An unprivileged unconfined program runs unshare -Ur true. On Debian it works. On Ubuntu the kernel moves the program into the profile unprivileged_userns, which has audit deny capability, and unshare fails with write failed /proc/self/uid_map: Operation not permitted. The sysctl kernel.apparmor_restrict_unprivileged_userns is 1 on Ubuntu; the kernel default is 0 and user space sets it.

Everywhere, a confined program needs userns,. On Ubuntu an unprivileged unconfined program that creates a user namespace is moved into the profile unprivileged_userns, which denies capabilities.

User namespaces come in two parts. The first is the same everywhere: a confined program needs a userns rule to create one, on all five kernels. The second is Ubuntu's. An unprivileged program with no profile is restricted too. When it creates a user namespace, the kernel moves it into a profile called unprivileged_userns, and that profile denies every capability. In our test, unshare with a root mapping failed on Ubuntu and worked on Debian. A sysctl switches this on. The kernel's own default is off; on Ubuntu, user space turns it on. So a program that needs namespaces on Ubuntu needs a profile of its own that says so.

Details and sources

Details

  • The guests: Debian 13 (kernel 6.12.116), Debian sid (7.3.4), Ubuntu 24.04 (6.8.0-147), Ubuntu 26.04 (7.0.0-43) and Ubuntu 26.10 (7.3.0-10), each a disposable virtual machine in which the profiles were compiled by the parser of the AppArmor tree the map describes, with the features of the running kernel.
  • Confined, without a userns, rule, unshare -U true failed on all five: apparmor="DENIED" operation="userns_create" class="namespace" profile="demo" pid=... comm="unshare" requested="userns_create" denied="userns_create" (with execpath="/usr/bin/unshare" appended on Debian sid, Ubuntu 26.04 and 26.10). Under a profile with userns, it worked.
  • Unprivileged and unconfined (runuser -u tester -- unshare ...), Debian 13 and Debian sid: -U, -Ur and -Urm all exited with status 0 and no record was logged.
  • The same on Ubuntu 24.04, 26.04 and 26.10: -U exited with status 0; -Ur and -Urm failed with unshare: write failed /proc/self/uid_map: Operation not permitted. Records: apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=... comm="unshare" requested="userns_create" target="unprivileged_userns" and apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=... comm="unshare" capability=21 capname="sys_admin".
  • The profile unprivileged_userns ships with AppArmor; its first rules are audit deny capability, and audit deny change_profile,, and it allows most other things. The file exists on the Debian guests too, where nothing is moved into it.
  • The sysctls on the Ubuntu guests: kernel.apparmor_restrict_unprivileged_userns = 1, kernel.apparmor_restrict_unprivileged_userns_force = 0, kernel.apparmor_restrict_unprivileged_userns_complain = 0. The Debian guests have none of the three.
  • Read from the source (all six Ubuntu versions): the default of the first sysctl is a kernel build option that Ubuntu's kernel configuration sets to off, so the value 1 on the guests is set from user space; what sets it was not determined. The profile name is fixed in the kernel; if no profile of that name is loaded the creation is denied. _force extends the check to confined profiles without a userns rule; _complain turns denials into complain-mode records.
  • AppArmor's init script switches the sysctl back to 0 when the kernel does not list policy/unconfined_restrictions/userns.
  • A second restriction, in mainline too: kernel.apparmor_restrict_unprivileged_unconfined. It is 1 on Ubuntu 26.04 and 26.10 and 0 on the other three guests. With 1, aa-exec -p demo by an unprivileged user ran under the stack demo//&unconfined and logged apparmor="AUDIT" operation="change_onexec" class="file" info="change_profile unprivileged unconfined converted to stacking" profile="unconfined" name="demo" ... target="demo//&unconfined".
  • A third, for io_uring: kernel.apparmor_restrict_unprivileged_io_uring, Ubuntu only, 0 on all three Ubuntu guests. Not run.

for AppArmor developers for security researchers

In the code

  • Mainline: the userns check for confined tasks (task.c:388-395), the sysctl of the unconfined restriction (lsm.c:2469).
  • Ubuntu (read from the source, tag Ubuntu-7.3.0-10.10): the move to unprivileged_userns is in security/apparmor/task.c:478-499; the sysctls in security/apparmor/lsm.c:2912-2941.
  • The shipped profile: unprivileged_userns:7-9. The init check: rc.apparmor.functions:144-154.

06 Prompting

PROMPTING prompt /etc/demo/prompted.conf r, do not decide in the kernel: ask demo Ubuntu's kernel .notify a listener sends the request up, waits, applies the answer read from Ubuntu's kernel source, not run nobody listening: cat: /etc/demo/prompted.conf: Permission denied apparmor="DENIED" operation="open" class="file" profile="demo-prompt" ... denied on all five kernels: the rule did not fail open mainline no .notify file: nobody to ask
The rule prompt /etc/demo/prompted.conf r. On Ubuntu's kernels the kernel sends the request to a listener on /sys/kernel/security/apparmor/.notify, waits and applies the answer; this path is read from Ubuntu's kernel source and was not run. With no listener the read was denied on all five kernels tested. Mainline has no .notify file.

A prompt rule asks a listener on .notify, a file only Ubuntu kernels have. With no listener the access was denied on all five kernels tested.

A rule marked prompt means: don't decide in the kernel, ask someone. That someone is a program listening on a special file, .notify, which exists on Ubuntu's kernels only. The kernel sends the request up, waits, and applies the answer. That path wasn't run for this deck; it's taken from Ubuntu's kernel source. What we did run is the case with nobody listening. The access was denied, on every kernel, Ubuntu's and mainline-based alike. So in that test a prompt rule didn't fail open. And on mainline, with no file to listen on, there's nobody to ask at all. Prompting, today, is a feature of Ubuntu's kernels.

Details and sources

Details

  • The guests: Debian 13 (kernel 6.12.116), Debian sid (7.3.4), Ubuntu 24.04 (6.8.0-147), Ubuntu 26.04 (7.0.0-43) and Ubuntu 26.10 (7.3.0-10), each a disposable virtual machine in which the profiles were compiled by the parser of the AppArmor tree the map describes, with the features of the running kernel.
  • The rule compiled without a message on all five, also with --warn=all. With no listener, cat /etc/demo/prompted.conf under the profile failed with "Permission denied" and the record was an ordinary denial: apparmor="DENIED" operation="open" class="file" profile="demo-prompt" name="/etc/demo/prompted.conf" pid=... comm="cat" requested_mask="r" denied_mask="r" fsuid=0 ouid=0.
  • /sys/kernel/security/apparmor/.notify exists, with mode 0666, on Ubuntu 24.04, 26.04 and 26.10, and on neither Debian guest.
  • The path with a listener was not run. Read from the source: the file is in all six Ubuntu versions (6.8 to 7.3) and in no mainline version. A listener registers a filter and receives and answers requests with ioctls on the file; a file access that a rule marks prompt is sent to it. The protocol version is 3 in Ubuntu 6.8 to 6.14 and 5 from 6.17. Ubuntu 7.0 adds a cache of answers with a timeout, kernel.apparmor_cache_timeout (5 on the 26.04 and 26.10 guests).
  • Feature entries for prompting, Ubuntu only: domain/interruptible (from 6.8), policy/notify/user (file from 6.11, file tags from 6.17), policy/notify_versions/v3 and v5 and policy/metadata_tagging_version (from 6.17).
  • Mainline does carry the prompt permission in its permission table, and unpacks it. What a mainline kernel does with it beyond denying, when no listener can exist, was not determined; in the run it denied.
  • Fourteen fixes to Ubuntu's notification and inet code went into all supported Ubuntu series in 2026 (read from the kernels' changelogs).
  • Known discrepancy: prompt capability X, is compiled as an allowed capability.

for AppArmor developers for security researchers

In the code

  • Mainline names prompt among the permission table's fields: apparmorfs.c:2631.
  • Ubuntu (read from the source, tag Ubuntu-7.3.0-10.10): the listener file in security/apparmor/apparmorfs.c:3112, the ioctls at 1147-1153, the upcall aa_do_notification in security/apparmor/notify.c:613, called from security/apparmor/file.c:160.
  • Parser: prompt rules are encoded when the kernel's permission table version is at least 2 (parser_common.c:189-212).

07 What each Ubuntu kernel adds

UBUNTU, RELEASE BY RELEASE 6.824.04message queues, addresses and ports, the prompt listener,the restrictions on unprivileged user namespaces and io_uring 6.1124.10larger state tables; a feature entry for prompting 6.1425.04the newer unix socket mediation (mainline: 6.17);a flag for queues on disconnected paths 6.1725.10prompt protocol 5, metadata tags on rules,a label permission for message queues 7.026.04packet and interface mediation: listed, off by default;a cache for prompt answers 7.326.10nothing new of its own: the difference to mainline shrinks read from the Ubuntu kernel sources; 6.8, 7.0 and 7.3 also seen running
What each Ubuntu kernel adds. 6.8 in 24.04: message queues, addresses and ports, the userns and io_uring restrictions, the prompt listener. 6.11 in 24.10: larger state tables, a feature entry for prompting. 6.14 in 25.04: network_v9 unix sockets ahead of mainline, the disconnected.ipc flag. 6.17 in 25.10: prompt protocol 5, metadata tags, the label permission for queues. 7.0 in 26.04: packet and interface mediation, listed and off by default, and a prompt answer cache. 7.3 in 26.10: nothing new of its own.

Ubuntu 6.8 has mqueue, inet conditions, the userns restriction and prompting. 6.11, 6.14, 6.17 and 7.0 each add a little; 7.3 adds nothing new. The full table is in the reference below.

Here's Ubuntu's side, release by release, taken from its kernel sources. 6.8, in 24.04, already has the big four: message queues, addresses and ports, the namespace restriction and the prompt listener. 6.11 adds a format for larger state tables. 6.14 brings the newer unix socket mediation, ahead of mainline, and a flag for queues on disconnected paths. 6.17 updates the prompt protocol and tags rules with metadata. 7.0, in 26.04, adds packet and interface mediation, listed but off by default, and a cache for prompt answers. And 7.3 adds nothing of its own: the difference shrinks as mainline takes pieces over.

Details and sources

Details

  • "Read from the source" means the Ubuntu kernel tree at the release tag named (Ubuntu-6.8.0-147.147, Ubuntu-6.11.0-29.29, Ubuntu-6.14.0-37.37, Ubuntu-6.17.0-41.41, Ubuntu-7.0.0-43.43, Ubuntu-7.3.0-10.10) or the mainline tag of the same version was read and nothing was run. One tag per series was read, the newest of each. The feature lists of the three tags that match a guest (6.8, 7.0, 7.3) equal the guests' feature files line for line.
  • 6.8 (Ubuntu 24.04). Only in Ubuntu against mainline 6.8: ipc/posix_mqueue, network_v8/af_inet, network/af_mask and network/af_unix, domain/interruptible, namespaces/userns_create, policy/unconfined_restrictions/userns and io_uring, the file .notify, and the four sysctls kernel.apparmor_restrict_unprivileged_userns, _userns_force, _userns_complain and kernel.apparmor_restrict_unprivileged_io_uring. Ahead of mainline, which got them in 6.17: caps/extended, dbus/mask, domain/kill.signal, domain/unconfined_allowed_children, and permission table version 3.
  • 6.11 (24.10) adds policy/state32 (mainline: 6.13) and policy/notify/user with the value file.
  • 6.14 (25.04) adds the network_v9 directory with af_unix, as a backport of what became mainline 6.17, and domain/disconnected.ipc.
  • 6.17 (25.10) adds policy/notify_versions/v3 and v5, policy/metadata_tagging_version, the value file tags in policy/notify/user, the word label in ipc/posix_mqueue, and execpath= in the user namespace record.
  • 7.0 (26.04) adds the network_v9_skb directory, the sysctls kernel.apparmor_packet_mediation and kernel.apparmor_cache_timeout, and, as backports from mainline's development branch, policy/diff_encode and policy/compressed_load. The packet mediation build option was switched on in one upload and off again two uploads later; the guest reports the sysctl as 0.
  • 7.3 (26.10) lists nothing that 7.0 did not, apart from entries mainline 7.3 has too (policy/diff-encode with a hyphen, policy/extended_policy_header). The 26.04 hardware enablement kernel is this kernel.
  • "Larger state tables": policy/state32, a table format for policy with more states than the older format can number.
  • Seen running: the 6.8, 7.0 and 7.3 rows, on the Ubuntu 24.04, 26.04 and 26.10 guests. The 6.11, 6.14 and 6.17 rows have no guest.
  • What was not read: interim kernels between the release and the tag read, derivative kernels (cloud, low latency, OEM), and 22.04 with its kernels.
  • The size of Ubuntu's change to security/apparmor against mainline of the same version: 51 files at 6.8, 40 at 6.17, 39 at 7.3 (the count also contains stable fixes).

08 What mainline has picked up

MAINLINE, RELEASE BY RELEASE 6.13larger state tables 6.17fine-grained unix sockets, the dbus entry, extended capabilities, a profile's own kill signal, permission table version 3 Ubuntu had most of these since 6.8 7.2the TCP fast open fix marker, differential encoding7.3compressed policy load, the extended policy header still only in Ubuntu at 7.3 message queues, addresses and ports, prompting, the user namespace and io_uring restrictions, packet mediation a newer mainline kernel closes some gaps, and not those
When mainline gained entries. 6.13: larger state tables. 6.17: fine-grained unix sockets, the dbus entry, extended capabilities, a profile's kill signal, permission table version 3. 7.2: the TCP fast open fix marker and differential encoding. 7.3: compressed policy load. Still only in Ubuntu at 7.3: message queues, addresses and ports, prompting, the userns and io_uring restrictions, packet mediation.

Mainline 6.17 took over fine-grained unix sockets, the dbus entry, extended capabilities, the kill signal and permission table version 3. Still Ubuntu-only at 7.3: mqueue, inet conditions, prompting, the restrictions and packet mediation.

Now the other direction. Much of what was once Ubuntu-only is in mainline today. The big step was 6.17: fine-grained unix sockets, the D-Bus entry, capabilities through the state machine, a profile's own kill signal, and the newer permission table all arrived together. Ubuntu had carried most of them since 6.8. Two later releases added smaller pieces. What's still Ubuntu-only at 7.3 is the list from the start of this deck: message queues, addresses and ports, prompting, the two restrictions and packet mediation. So a newer mainline kernel closes some gaps, and not those.

Details and sources

Details

  • Read from the source: the feature tables of mainline at the tags v6.8, v6.11 to v6.17, v7.0 to v7.3. Equal tables: 6.8 to 6.12, 6.13 to 6.16, and 6.17 to 7.1.
  • 6.13: policy/state32.
  • 6.17: network_v9/af_mask and network_v9/af_unix, dbus/mask, caps/extended, domain/kill.signal, domain/unconfined_allowed_children, and policy/permstable32_version from 1 to 3. The parser treats versions below 2 as "no extended permission table", so on mainline up to 6.16 (and on Debian 13's 6.12) that table is not used.
  • 7.2: network_v8/tcp-fast-open and network_v9/tcp-fast-open (a marker that the implicit connect of a TCP fast open sendmsg is checked), and policy/diff-encode.
  • 7.3: policy/compressed_load and policy/extended_policy_header. Mainline 7.3 also carries a file for inet mediation and the class number of packet mediation, without a feature entry for either: the parser emits no rules for them there.
  • Seen running: Debian 13's kernel 6.12.116 has 38 feature files and Debian sid's 7.3.4 has 49, matching the tables. Debian 13 has network_v8/tcp-fast-open through a stable update. On Debian 13 the twelve-rule profile lost its unix rule to a downgrade and its dbus rule ("dbus rules not enforced"), and a confined busctl call that four other guests' bus daemons refused went through.
  • Two places where the trees still disagree after mainline took a feature (read from the source): mainline enforces unix rules only for profiles compiled for the newest network class, where Ubuntu falls back to the older classes; and mainline answers D-Bus permission queries only for such profiles, a change Ubuntu 6.17, 7.0 and 7.3 revert. A profile that pins an older abi file can therefore behave differently on the two.
  • Still Ubuntu-only at 7.3: ipc/posix_mqueue and domain/disconnected.ipc; network_v8/af_inet; .notify, policy/notify*, policy/metadata_tagging_version, domain/interruptible; namespaces/userns_create, policy/unconfined_restrictions/* and their sysctls; network_v9_skb; network/.
  • The map's kernel source is mainline after 7.3. Its tables have the entries of 7.3 and one more, network_v8/sctp.

for AppArmor developers for security researchers

In the code

09 Listed is not the same as enforced for security researchers

FOR AN AUDIT features/network_v9_skb/iface kernel.apparmor_packet_mediation = 0 1. listed means the code is there, not that it is on kernel.apparmor_restrict_unprivileged_userns = 1 kernel default 0; user space sets it profile unprivileged_userns { ... } the name is fixed in the kernel 2. the restriction is configuration plus a loaded profile, not a kernel default deny network (connect) inet stream peer=(ip=127.0.0.1 port=25), without af_inet: every port refused and an mqueue rule: left out 3. the same policy means something else on a kernel with fewer features audit the feature directory and the sysctls of the machine, not the profile alone
Three traps. One: Ubuntu 7.0 lists network_v9_skb feature files while kernel.apparmor_packet_mediation is 0: listed, not on. Two: kernel.apparmor_restrict_unprivileged_userns is 1 on Ubuntu, the kernel default is 0, user space sets it, and the kernel relies on a loaded profile named unprivileged_userns. Three: the same policy on a kernel with fewer features: a deny rule for port 25 refused every port, and an mqueue rule was left out. Audit the feature directory and the sysctls, not the profile alone.

A feature file means the code exists, not that it is on. The userns restriction is a sysctl set by user space and depends on a named profile. The same policy means something else on a kernel with fewer features.

For an audit, three traps. First, a feature file says the code is there, not that it's on. Ubuntu 7.0 lists packet mediation, and a sysctl keeps it off. Second, the namespace restriction isn't a kernel default. User space sets the sysctl, and the kernel counts on a profile with a fixed name being loaded; without it, the source says, creation is denied. Third, the same policy changes meaning on a kernel with fewer features, silently. A rule denying one port refused every port on our mainline-based kernel, and a message queue rule vanished. So audit the machine's feature directory and sysctls, not the profile alone.

Details and sources

for security researchers

Details

  • Trap 1. Seen on the Ubuntu 26.04 and 26.10 guests: all six network_v9_skb feature files are listed and kernel.apparmor_packet_mediation = 0. Read from the source: the feature tables are static, and packet mediation runs only when that switch is on; its default is a build option that Ubuntu's configuration sets to off.
  • Trap 2. Seen: kernel.apparmor_restrict_unprivileged_userns = 1 on the three Ubuntu guests. Read from the source: the build option behind its default is off in every Ubuntu series read, so the value is set from user space (what sets it was not determined); the kernel moves the task into the profile named unprivileged_userns and, if no profile of that name is loaded, denies the creation ("Userns create restricted - failed to find unprivileged_userns profile"). That last case was not run. The sysctl has mode 0644; _force and _complain have 0600.
  • The shipped unprivileged_userns profile includes local/unprivileged_userns if it exists, so a site file can widen it.
  • Trap 3. Seen on Debian sid (kernel 7.3.4, no af_inet): with network inet stream, and the deny rule on the slide, connects to port 22 and to port 25 both failed with EACCES; on Ubuntu 26.04 only port 25 did. The mqueue rule: left out on Debian sid and Debian 13 with a message only under --warn=all.
  • Known discrepancy: inet conditionals are dropped silently when the kernel has no af_inet, so deny rules get wider.
  • Known discrepancy: an allow rule limited by peer=(ip=... port=...) does not limit connect on Ubuntu 26.04. Seen there with the tree's parser; the cause is not determined.
  • A widened deny refuses more than intended; a dropped condition on an allow rule allows more than intended. Both follow from the same mechanism.
  • kernel.apparmor_restrict_unprivileged_unconfined is 1 on Ubuntu 26.04 and 26.10 and 0 on 24.04 and both Debian guests: the same question, "is it on here", applies to it.

for security researchers

Attack surface

  • .notify has mode 0666 on Ubuntu kernels (seen). Who may register as a listener and for which tasks is decided in the kernel; it was not examined here. Fourteen security fixes to the notification and inet code went into all supported Ubuntu series in 2026 (read from the changelogs).
  • Sysctls that change mediation at run time, all writable by root: the three apparmor_restrict_unprivileged_userns*, apparmor_restrict_unprivileged_unconfined, apparmor_restrict_unprivileged_io_uring, apparmor_packet_mediation, apparmor_cache_timeout.
  • A profile that pins an older abi file gets its unix rules enforced on Ubuntu and not on mainline (read from the source): see the scene "What mainline has picked up".

10 From the kernels to the rules that differ

ROADS /sys/kernel/security/apparmor/features adm-features which kernel do you have? syn-mqueuesyn-network-inetsyn-usernssyn-prompt the rules that differ sec-usernsdbus-mediation the restriction enforced by the bus daemon adm-denialssec-unmediated the records what no kernel checks
The features directory in the centre, with a road to adm-features for reading your own kernel's feature set. Roads to the rules that differ: syn-mqueue, syn-network-inet, syn-userns and syn-prompt. Roads to sec-userns, dbus-mediation, adm-denials, syn-unix and sec-unmediated.

List /sys/kernel/security/apparmor/features to see what your kernel has. Roads: kernel features, the four kinds of rule that differ, the userns restriction, D-Bus, the records, and what no kernel mediates.

So: one language, different kernels. To see which one you have, list the feature directory. The deck on kernel features shows how, and how to make the parser tell you what it left out. Each difference has its own deck: message queue rules, network address conditionals, user namespace rules and the prompt qualifier. User namespaces and AppArmor goes deeper into the restriction. D-Bus is a separate story, enforced by the bus daemon, with a deck of its own. Reading a denial covers the records, including the ones only Ubuntu's kernels write. And what no kernel checks at all is in what is not mediated.

Details and sources

Read more

Basis of the statements on this page: "seen" means observed in a disposable guest: Debian 13 (kernel 6.12.116), Debian sid (7.3.4), Ubuntu 24.04 (6.8.0-147), Ubuntu 26.04 (7.0.0-43) or Ubuntu 26.10 (7.3.0-10), with profiles compiled by the parser of the AppArmor commit 836052d21 against the running kernel's features. "source" means read from a kernel tree and not run: the Ubuntu release tags Ubuntu-6.8.0-147.147 (24.04), Ubuntu-6.11.0-29.29 (24.10), Ubuntu-6.14.0-37.37 (25.04), Ubuntu-6.17.0-41.41 (25.10), Ubuntu-7.0.0-43.43 (26.04), Ubuntu-7.3.0-10.10 (26.10), and the mainline tags of the same versions. Debian's kernels stand for mainline where something was seen running: Debian sid's feature files equal mainline 7.3's tables (the later mainline commit the rest of the map describes has one more entry, network_v8/sctp). One tag per Ubuntu series was read; derivative kernels and 22.04 were not.

The differences at a glance

MainlineUbuntu kernelsBasis
POSIX message queuesno mediation of queues; the mqueue rule is left out; a confined open is refused as a file with a disconnected pathmqueue rules enforced, records with class="posix_mqueue"seen (Debian 13, sid; Ubuntu 24.04, 26.04, 26.10); source for 6.11 to 6.17
ip= and port=not compiled; the rule stays a family and type rule; no warningenforced where checked: a local address mismatch is denied with info="failed local addr match", daddr=, dest=; a deny with peer=( ) worksseen (sid; 26.04); source
an allow rule limited by peer=(ip= port=)not compileddid not limit connect on 26.04seen; cause not determined
interface=, packet mediationno feature entrylisted from 7.0, switched off (kernel.apparmor_packet_mediation = 0)seen (sysctl); source
a confined task creating a user namespaceneeds userns,needs userns,seen on all five
an unprivileged unconfined task creating oneallowedmoved into the profile unprivileged_userns when kernel.apparmor_restrict_unprivileged_userns is 1; the guests have 1seen
prompt rulesno listener file; denied in the testlistener on .notify; denied when nobody listensseen without a listener; source with one
fine-grained unix socketsfrom 6.17 (network_v9/af_unix)since before 6.8 (network/af_unix), network_v9/af_unix from 6.14seen (13: none; sid, 24.04, 26.04, 26.10: enforced); source
the dbus entryfrom 6.17since 6.8seen (Debian 13 has none); source
unprivileged unconfined change_profilekernel.apparmor_restrict_unprivileged_unconfined, 0 on the Debian gueststhe same sysctl, 0 on 24.04, 1 on 26.04 and 26.10: converted to a stack with unconfinedseen
io_uring for unconfined tasksnot restrictedkernel.apparmor_restrict_unprivileged_io_uring, 0 on the guestsseen (sysctl); source

What each Ubuntu kernel adds

KernelUbuntuNew against the previous Ubuntu kernelBasis
6.824.04ipc/posix_mqueue; network_v8/af_inet; network/af_unix, network/af_mask; domain/interruptible, .notify; namespaces/userns_create, policy/unconfined_restrictions/{userns,io_uring} and four sysctls; ahead of mainline: caps/extended, dbus/mask, domain/kill.signal, domain/unconfined_allowed_children, permission table version 3source; seen
6.1124.10policy/state32; policy/notify/user = filesource
6.1425.04network_v9/af_unix and af_mask (backport); domain/disconnected.ipcsource
6.1725.10policy/notify_versions/{v3,v5}, policy/metadata_tagging_version, policy/notify/user = file tags; label in ipc/posix_mqueue; execpath= in the userns recordsource
7.026.04network_v9_skb/*; kernel.apparmor_packet_mediation, kernel.apparmor_cache_timeout; backports policy/diff_encode, policy/compressed_load; network_v8/tcp-fast-open, network_v9/tcp-fast-opensource; seen
7.326.10policy/diff-encode (hyphen) and policy/extended_policy_header, both also in mainline 7.3source; seen

When mainline gained each entry

MainlineEntriesBasis
6.13policy/state32source
6.17network_v9/{af_mask,af_unix}, dbus/mask, caps/extended, domain/kill.signal, domain/unconfined_allowed_children, policy/permstable32_version 1 to 3source; seen as present on Debian sid and absent on Debian 13
7.2network_v8/tcp-fast-open, network_v9/tcp-fast-open, policy/diff-encodesource
7.3policy/compressed_load, policy/extended_policy_header; inet and packet mediation as code without feature entriessource

Feature entries, version by version

Every feature entry that differs between mainline (M) and Ubuntu (U) of the same version, plus two that both gained in 7.3. - means absent. Read from the source; the 6.8, 7.0 and 7.3 Ubuntu columns and the 7.3 mainline column equal what the guests listed.

feature6.8 M6.8 U6.11 M6.11 U6.14 M6.14 U6.17 M6.17 U7.0 M7.0 U7.3 M7.3 U
caps/extended-yes-yes-yesyesyesyesyesyesyes
dbus/mask-yes-yes-yesyesyesyesyesyesyes
domain/disconnected.ipc-----yes-yes-yes-yes
domain/interruptible-yes-yes-yes-yes-yes-yes
domain/kill.signal-yes-yes-yesyesyesyesyesyesyes
domain/unconfined_allowed_children-yes-yes-yesyesyesyesyesyesyes
ipc/posix_mqueue-yes-yes-yes-yes-yes-yes
namespaces/userns_create-pciu&-pciu&-pciu&-pciu&-pciu&-pciu&
network/af_mask-yes-yes-yes-yes-yes-yes
network/af_unix-yes-yes-yes-yes-yes-yes
network/tcp-fast-open-yes----------
network_v8/af_inet-yes-yes-yes-yes-yes-yes
network_v8/tcp-fast-open-yes-------yesyesyes
network_v9/af_mask-----yesyesyesyesyesyesyes
network_v9/af_unix-----yesyesyesyesyesyesyes
network_v9/tcp-fast-open---------yesyesyes
network_v9_skb/af_mask---------inet inet6-inet inet6
network_v9_skb/iface---------receive connect, secmark_postroute-receive connect, secmark_postroute
network_v9_skb/localout---------secmark_set-secmark_set
network_v9_skb/postroute---------secmark_send-secmark_send
network_v9_skb/rcv_skb---------secmark_receive-secmark_receive
network_v9_skb/relabel---------setcred-setcred
policy/compressed_load---------yesyesyes
policy/diff_encode---------yes--
policy/metadata_tagging_version-------1-1-1
policy/notify/user---file-file-file tags-file tags-file tags
policy/notify_versions/v3-------yes-yes-yes
policy/notify_versions/v5-------yes-yes-yes
policy/permstable32_version131313333333
policy/state32---111111111
policy/unconfined_restrictions/io_uring-yes-yes-yes-yes-yes-yes
policy/unconfined_restrictions/userns-yes-yes-yes-yes-yes-yes
policy/diff-encode----------yesyes
policy/extended_policy_header----------yesyes

The values of policy/unconfined_restrictions/* print as yes in Ubuntu 6.8 and 6.11 and as 1 from 6.14. Equal in both trees at every version: policy/versions v5 to v9, policy/set_load, policy/outofband, policy/permstable32, mount/*, signal/mask, ptrace/mask, io_uring/mask, namespaces/mask, file/mask, query/label/*, rlimit/mask, caps/mask.

Sysctls

Sysctl (kernel.)MainlineUbuntuSeen
unprivileged_userns_apparmor_policyyesyes1 on all five
apparmor_display_secid_modeyesyes0 on all five
apparmor_restrict_unprivileged_unconfinedyesyes0 on Debian 13, sid and Ubuntu 24.04; 1 on 26.04 and 26.10
apparmor_restrict_unprivileged_usernsnofrom 6.81 on 24.04, 26.04, 26.10
apparmor_restrict_unprivileged_userns_force, _complainnofrom 6.80
apparmor_restrict_unprivileged_io_uringnofrom 6.80
apparmor_cache_timeoutnofrom 7.05 on 26.04 and 26.10
apparmor_packet_mediationnofrom 7.00 on 26.04 and 26.10

The kernel's default of apparmor_restrict_unprivileged_userns is a build option that Ubuntu's configuration sets to off in every series read (source); the value 1 is set from user space.

Records only Ubuntu kernels wrote

RecordSeen on
operation="create" class="posix_mqueue" ... name="/demo" ... requested="create" denied="create" class="posix_mqueue" fsuid=0 ouid=024.04, 26.04, 26.10
operation="connect" class="net" info="failed local addr match" error=-13 ... daddr=127.0.0.1 dest=22 family="inet" sock_type="stream" protocol=6 requested="connect" denied="connect"26.04 (and 24.04, 26.10 in earlier recorded runs)
apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" ... target="unprivileged_userns"24.04, 26.04, 26.10
apparmor="AUDIT" operation="change_onexec" class="file" info="change_profile unprivileged unconfined converted to stacking" profile="unconfined" name="demo" ... target="demo//&unconfined"26.04, 26.10
two extra apparmor="ALLOWED" operation="file_perm" records for one complain-mode read26.04, 26.10

The same profile on five kernels

The twelve-rule profile with abi <abi/5.0>,, compiled in each guest by the tree's parser with -Q -K --warn=all (seen).

Guest kernelFeature filesWarningsrule: lines
Debian 13, 6.12.11638unix rule downgraded; dbus and mqueue rules not enforced19
Ubuntu 24.04, 6.8.0-14751none66
Ubuntu 26.04, 7.0.0-4367none67
Debian sid, 7.3.449mqueue rules not enforced24
Ubuntu 26.10, 7.3.0-1068none67

Known discrepancies

  • inet conditionals are dropped silently when the kernel has no af_inet, so deny rules get wider (seen on Debian sid).
  • An allow rule limited by peer=(ip=... port=...) does not limit connect on Ubuntu 26.04 (seen; cause not determined).
  • A POSIX message queue on a kernel without mqueue mediation is refused as a file with a disconnected path (seen on Debian 13 and sid, also under a profile with an mqueue rule for the queue).
  • Ubuntu's mqueue record writes class="posix_mqueue" twice.
  • prompt capability X, is compiled as an allowed capability.
  • network inet icmp carries protocol number 2, which is IGMP (it matters only where af_inet is present).

Not determined

  • What sets the two restriction sysctls to 1 on Ubuntu.
  • Prompting with a listener, packet mediation switched on, the io_uring restriction switched on, and the _force and _complain variants of the userns restriction: not run.
  • Ubuntu 6.11, 6.14 and 6.17 on a running system: no guest.
  • What a mainline kernel does with a prompt permission beyond the denial seen.

for AppArmor developers for security researchers

In the code

  • Mainline feature tables of the map's tree: apparmorfs.c:2579-2701, net.c:24-36; mainline sysctls: lsm.c:2454-2469.
  • Ubuntu (source, tag Ubuntu-7.3.0-10.10, paths under security/apparmor/): the listener file apparmorfs.c:3112; the userns transition task.c:478-499; mqueue checks ipc.c:209; inet matching af_inet.c:271-312; the sysctls lsm.c:2912-2955; packet mediation's switch lsm.c:1887; the unix fallback to older classes include/policy.h:373-388.
  • The parser's feature lookups: parser_main.c:1030-1125; the init check for the userns restriction: rc.apparmor.functions:144-154.

Roads from here

QUALIFIERS

RULE CLASSES

SECURITY · threat model and limits

RUNNING THE PARSER

LIBAPPARMOR