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
- Why AppArmor — what a profile and a kernel check are
- The abi rule and the abi files — why a kind of rule can be accepted and not enforced
Part of journeys
- Network, IPC and privileges, step 13 of 14 · previous: D-Bus mediation · next: Kernel features and the policy ABI
01 One profile, two kernels
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 printedWarning from profile demo-all (demo-all.sd): mqueue type=posix rules not enforced; Ubuntu 26.10 printed nothing. Without--warn=allneither 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
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.ipcbelongs to message queues (a profile flag for queues reached through a disconnected path);namespaces/userns_createbelongs to the user namespace restriction. The slide putsdomain/interruptiblewith 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/.notifyand 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
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-okopened;/demo-otherfailed withEACCESand the recordapparmor="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 enforcedunder--warn=alland loaded the profile with exit status 0. Both names failed withEACCESand the recordapparmor="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. Anmqueuerule 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(permissionscreate read write open delete setattr getattr, andlabelfrom 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 entrydomain/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 toaa_mqueue_perm(security/apparmor/ipc.c:209); the feature entry is insecurity/apparmor/apparmorfs.c. - Parser: mqueue.cc:195-218.
04 Addresses and ports
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 withEACCES; 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".daddranddestare fields that mainline records do not have. Withip=127.0.0.1the connects passed.- The same profile on Debian sid: port 22 connected, port 25 got "Connection refused";
--warn=allprinted nothing when the profile was compiled. network inet stream,withdeny network (connect) inet stream peer=(ip=127.0.0.1 port=25),: on Ubuntu 26.04 port 22 connected and port 25 failed withEACCES. On Debian sid both failed withEACCES.- Known discrepancy: inet conditionals are dropped silently when the kernel has no
af_inet, sodenyrules 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 limitconnecton Ubuntu 26.04. Withnetwork 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_inetis 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 fileaf_inet.cwhose checks compare family, type and protocol only; Ubuntu 7.3 replaces about a thousand lines of it. The parser also asks fornetwork_v9/af_inet, which no kernel read has. - Interfaces (
interface=) neednetwork_v9_skb/iface: Ubuntu 7.0 and 7.3 list it and keep packet mediation switched off (kernel.apparmor_packet_mediation = 0on both guests). Not run.
for AppArmor developers for security researchers
In the code
- Parser: the condition is encoded only with
network_v8/af_inetornetwork_v9/af_inetin both feature sets (parser_main.c:1062-1067, network.cc:1031). - Mainline's network feature entries: net.c:24-36.
05 User namespaces
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 truefailed on all five:apparmor="DENIED" operation="userns_create" class="namespace" profile="demo" pid=... comm="unshare" requested="userns_create" denied="userns_create"(withexecpath="/usr/bin/unshare"appended on Debian sid, Ubuntu 26.04 and 26.10). Under a profile withuserns,it worked. - Unprivileged and unconfined (
runuser -u tester -- unshare ...), Debian 13 and Debian sid:-U,-Urand-Urmall exited with status 0 and no record was logged. - The same on Ubuntu 24.04, 26.04 and 26.10:
-Uexited with status 0;-Urand-Urmfailed withunshare: 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"andapparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=... comm="unshare" capability=21 capname="sys_admin". - The profile
unprivileged_usernsships with AppArmor; its first rules areaudit deny capability,andaudit 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.
_forceextends the check to confined profiles without a userns rule;_complainturns 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 demoby an unprivileged user ran under the stackdemo//&unconfinedand loggedapparmor="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 tounprivileged_usernsis insecurity/apparmor/task.c:478-499; the sysctls insecurity/apparmor/lsm.c:2912-2941. - The shipped profile: unprivileged_userns:7-9. The init check: rc.apparmor.functions:144-154.
06 Prompting
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.confunder 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/.notifyexists, 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
promptis 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(filefrom 6.11,file tagsfrom 6.17),policy/notify_versions/v3andv5andpolicy/metadata_tagging_version(from 6.17). - Mainline does carry the
promptpermission 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
promptamong the permission table's fields: apparmorfs.c:2631. - Ubuntu (read from the source, tag
Ubuntu-7.3.0-10.10): the listener file insecurity/apparmor/apparmorfs.c:3112, the ioctls at1147-1153, the upcallaa_do_notificationinsecurity/apparmor/notify.c:613, called fromsecurity/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 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_maskandnetwork/af_unix,domain/interruptible,namespaces/userns_create,policy/unconfined_restrictions/usernsandio_uring, the file.notify, and the four sysctlskernel.apparmor_restrict_unprivileged_userns,_userns_force,_userns_complainandkernel.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) andpolicy/notify/userwith the valuefile. - 6.14 (25.04) adds the
network_v9directory withaf_unix, as a backport of what became mainline 6.17, anddomain/disconnected.ipc. - 6.17 (25.10) adds
policy/notify_versions/v3andv5,policy/metadata_tagging_version, the valuefile tagsinpolicy/notify/user, the wordlabelinipc/posix_mqueue, andexecpath=in the user namespace record. - 7.0 (26.04) adds the
network_v9_skbdirectory, the sysctlskernel.apparmor_packet_mediationandkernel.apparmor_cache_timeout, and, as backports from mainline's development branch,policy/diff_encodeandpolicy/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-encodewith 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/apparmoragainst 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 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.11tov6.17,v7.0tov7.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_maskandnetwork_v9/af_unix,dbus/mask,caps/extended,domain/kill.signal,domain/unconfined_allowed_children, andpolicy/permstable32_versionfrom 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-openandnetwork_v9/tcp-fast-open(a marker that the implicit connect of a TCP fast opensendmsgis checked), andpolicy/diff-encode. - 7.3:
policy/compressed_loadandpolicy/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-openthrough 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 confinedbusctlcall 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_mqueueanddomain/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
- The map's mainline tables: apparmorfs.c:2579-2701, net.c:24-36. The gate on D-Bus queries: apparmorfs.c:883-889.
- The parser's reading of the permission table version: parser_main.c:1770-1785; of both spellings of differential encoding: parser_main.c:1746-1753.
09 Listed is not the same as enforced for security researchers
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_skbfeature files are listed andkernel.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 = 1on 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 namedunprivileged_usernsand, 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;_forceand_complainhave 0600. - The shipped
unprivileged_usernsprofile includeslocal/unprivileged_usernsif it exists, so a site file can widen it. - Trap 3. Seen on Debian sid (kernel 7.3.4, no
af_inet): withnetwork inet stream,and the deny rule on the slide, connects to port 22 and to port 25 both failed withEACCES; 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, sodenyrules get wider. - Known discrepancy: an allow rule limited by
peer=(ip=... port=...)does not limitconnecton 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_unconfinedis 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
.notifyhas 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".
for security researchers
Read more
10 From the kernels to the rules that differ
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
- Kernel features and the policy ABI, The abi rule and the abi files.
- Message queue rules, Network address conditionals, User namespace rules, The prompt qualifier, Unix socket rules.
- User namespaces and AppArmor, D-Bus mediation, Reading a denial, What is not mediated.
- wiki: Kernel_Feature_Matrix, wiki: Userspace_Feature_Matrix, apparmor.net: Ubuntu.
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
| Mainline | Ubuntu kernels | Basis | |
|---|---|---|---|
| POSIX message queues | no mediation of queues; the mqueue rule is left out; a confined open is refused as a file with a disconnected path | mqueue 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 warning | enforced where checked: a local address mismatch is denied with info="failed local addr match", daddr=, dest=; a deny with peer=( ) works | seen (sid; 26.04); source |
an allow rule limited by peer=(ip= port=) | not compiled | did not limit connect on 26.04 | seen; cause not determined |
interface=, packet mediation | no feature entry | listed from 7.0, switched off (kernel.apparmor_packet_mediation = 0) | seen (sysctl); source |
| a confined task creating a user namespace | needs userns, | needs userns, | seen on all five |
| an unprivileged unconfined task creating one | allowed | moved into the profile unprivileged_userns when kernel.apparmor_restrict_unprivileged_userns is 1; the guests have 1 | seen |
prompt rules | no listener file; denied in the test | listener on .notify; denied when nobody listens | seen without a listener; source with one |
| fine-grained unix sockets | from 6.17 (network_v9/af_unix) | since before 6.8 (network/af_unix), network_v9/af_unix from 6.14 | seen (13: none; sid, 24.04, 26.04, 26.10: enforced); source |
the dbus entry | from 6.17 | since 6.8 | seen (Debian 13 has none); source |
unprivileged unconfined change_profile | kernel.apparmor_restrict_unprivileged_unconfined, 0 on the Debian guests | the same sysctl, 0 on 24.04, 1 on 26.04 and 26.10: converted to a stack with unconfined | seen |
| io_uring for unconfined tasks | not restricted | kernel.apparmor_restrict_unprivileged_io_uring, 0 on the guests | seen (sysctl); source |
What each Ubuntu kernel adds
| Kernel | Ubuntu | New against the previous Ubuntu kernel | Basis |
|---|---|---|---|
| 6.8 | 24.04 | ipc/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 3 | source; seen |
| 6.11 | 24.10 | policy/state32; policy/notify/user = file | source |
| 6.14 | 25.04 | network_v9/af_unix and af_mask (backport); domain/disconnected.ipc | source |
| 6.17 | 25.10 | policy/notify_versions/{v3,v5}, policy/metadata_tagging_version, policy/notify/user = file tags; label in ipc/posix_mqueue; execpath= in the userns record | source |
| 7.0 | 26.04 | network_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-open | source; seen |
| 7.3 | 26.10 | policy/diff-encode (hyphen) and policy/extended_policy_header, both also in mainline 7.3 | source; seen |
When mainline gained each entry
| Mainline | Entries | Basis |
|---|---|---|
| 6.13 | policy/state32 | source |
| 6.17 | network_v9/{af_mask,af_unix}, dbus/mask, caps/extended, domain/kill.signal, domain/unconfined_allowed_children, policy/permstable32_version 1 to 3 | source; seen as present on Debian sid and absent on Debian 13 |
| 7.2 | network_v8/tcp-fast-open, network_v9/tcp-fast-open, policy/diff-encode | source |
| 7.3 | policy/compressed_load, policy/extended_policy_header; inet and packet mediation as code without feature entries | source |
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.
| feature | 6.8 M | 6.8 U | 6.11 M | 6.11 U | 6.14 M | 6.14 U | 6.17 M | 6.17 U | 7.0 M | 7.0 U | 7.3 M | 7.3 U |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| caps/extended | - | yes | - | yes | - | yes | yes | yes | yes | yes | yes | yes |
| dbus/mask | - | yes | - | yes | - | yes | yes | yes | yes | yes | yes | yes |
| domain/disconnected.ipc | - | - | - | - | - | yes | - | yes | - | yes | - | yes |
| domain/interruptible | - | yes | - | yes | - | yes | - | yes | - | yes | - | yes |
| domain/kill.signal | - | yes | - | yes | - | yes | yes | yes | yes | yes | yes | yes |
| domain/unconfined_allowed_children | - | yes | - | yes | - | yes | yes | yes | yes | yes | yes | yes |
| 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 | - | - | - | - | - | - | - | yes | yes | yes |
| network_v9/af_mask | - | - | - | - | - | yes | yes | yes | yes | yes | yes | yes |
| network_v9/af_unix | - | - | - | - | - | yes | yes | yes | yes | yes | yes | yes |
| network_v9/tcp-fast-open | - | - | - | - | - | - | - | - | - | yes | yes | yes |
| 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 | - | - | - | - | - | - | - | - | - | yes | yes | yes |
| 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_version | 1 | 3 | 1 | 3 | 1 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
| policy/state32 | - | - | - | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| policy/unconfined_restrictions/io_uring | - | yes | - | yes | - | yes | - | yes | - | yes | - | yes |
| policy/unconfined_restrictions/userns | - | yes | - | yes | - | yes | - | yes | - | yes | - | yes |
| policy/diff-encode | - | - | - | - | - | - | - | - | - | - | yes | yes |
| policy/extended_policy_header | - | - | - | - | - | - | - | - | - | - | yes | yes |
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.) | Mainline | Ubuntu | Seen |
|---|---|---|---|
unprivileged_userns_apparmor_policy | yes | yes | 1 on all five |
apparmor_display_secid_mode | yes | yes | 0 on all five |
apparmor_restrict_unprivileged_unconfined | yes | yes | 0 on Debian 13, sid and Ubuntu 24.04; 1 on 26.04 and 26.10 |
apparmor_restrict_unprivileged_userns | no | from 6.8 | 1 on 24.04, 26.04, 26.10 |
apparmor_restrict_unprivileged_userns_force, _complain | no | from 6.8 | 0 |
apparmor_restrict_unprivileged_io_uring | no | from 6.8 | 0 |
apparmor_cache_timeout | no | from 7.0 | 5 on 26.04 and 26.10 |
apparmor_packet_mediation | no | from 7.0 | 0 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
| Record | Seen on |
|---|---|
operation="create" class="posix_mqueue" ... name="/demo" ... requested="create" denied="create" class="posix_mqueue" fsuid=0 ouid=0 | 24.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 read | 26.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 kernel | Feature files | Warnings | rule: lines |
|---|---|---|---|
| Debian 13, 6.12.116 | 38 | unix rule downgraded; dbus and mqueue rules not enforced | 19 |
| Ubuntu 24.04, 6.8.0-147 | 51 | none | 66 |
| Ubuntu 26.04, 7.0.0-43 | 67 | none | 67 |
| Debian sid, 7.3.4 | 49 | mqueue rules not enforced | 24 |
| Ubuntu 26.10, 7.3.0-10 | 68 | none | 67 |
Known discrepancies
- inet conditionals are dropped silently when the kernel has no
af_inet, sodenyrules get wider (seen on Debian sid). - An allow rule limited by
peer=(ip=... port=...)does not limitconnecton 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
mqueuerule for the queue). - Ubuntu's mqueue record writes
class="posix_mqueue"twice. prompt capability X,is compiled as an allowed capability.network inet icmpcarries protocol number 2, which is IGMP (it matters only whereaf_inetis 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
_forceand_complainvariants 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
promptpermission 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 undersecurity/apparmor/): the listener fileapparmorfs.c:3112; the userns transitiontask.c:478-499; mqueue checksipc.c:209; inet matchingaf_inet.c:271-312; the sysctlslsm.c:2912-2955; packet mediation's switchlsm.c:1887; the unix fallback to older classesinclude/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
- The prompt qualifier — the prompt qualifier
RULE CLASSES
- Message queue rules — message queue rules
- Network address conditionals — address and port conditions
- User namespace rules — user namespace rules
- Unix socket rules — unix socket rules across kernels
SECURITY · threat model and limits
- User namespaces and AppArmor (no slides yet) — the restriction of unprivileged user namespaces
- What is not mediated — what no kernel checks
RUNNING THE PARSER
- Kernel features and the policy ABI — read the feature set of your own kernel
- Reading a denial — the records each kernel writes
LIBAPPARMOR
- D-Bus mediation — the part the bus daemon enforces