What is not mediated
operations no rule covers for security researchers for application developers
Operations a confined program can perform without any rule being consulted. Reading file metadata and changing extended attributes and timestamps. ioctl on an open descriptor. Mounts made through the file-descriptor mount calls. System V IPC and keyrings. Each with the hook that is missing and a run on a real kernel - and what a profile's file rules do promise.
On the map: security
▶ Watch this deck — 9 scenes, ~7 min
Worth seeing first
- The limits of name-based mediation — a file rule is a promise about a name
- File access modes — what the permission letters of a file rule cover
Part of journeys
- Hardening a privileged program, step 11 of 11 · previous: The limits of name-based mediation
01 Some operations never ask
Under a profile with no rule for a file, opening, listing, chmod and truncate are denied and logged, while stat, readlink, chdir, extended attributes, timestamps and ioctl are not checked at all. Observed in one run.
Demo's profile allows reading one file and nothing else. So you'd expect everything else demo tries to end in a denial and a log line. Most of it does: opening the secret, listing the directory, changing its mode. But in the same run, demo stats the secret, reads where a symlink points, changes the secret's extended attributes and its timestamps, and nothing is denied or logged. Those operations never reach a rule. That happens for three reasons, and this deck goes through them. AppArmor has no function for the question. Or the kernel asks nobody. Or the answer is always yes. Then we'll see what a profile really promises.
Details and sources
Details
- "Not mediated" in this deck always means one of three things: AppArmor registers no function for the hook the kernel calls; the kernel calls no security hook for the operation; or AppArmor's function runs and its check cannot fail.
- Ordinary permission checks (owner, mode bits, ACLs), capabilities, seccomp filters and other security modules apply in every case. The examples run as root on root-owned files so that none of those gets in the way.
- Denied and logged in the run (file
/etc/demo/secret, no rule):open O_RDONLY, opening the directory/etc/demo/private,chmod,truncate. For exampleapparmor="DENIED" operation="chmod" class="file" profile="demo-t" name="/etc/demo/secret" comm="t" requested_mask="w" denied_mask="w". - Allowed with no audit record in the same run:
stat,access(R_OK),readlink,chdir,open(O_PATH)andfstat,getxattr,listxattr,setxattr,utimensat, andioctl(FS_IOC_SETFLAGS)on a descriptor opened read-only. - None of this depends on the profile's mode. An operation that is not mediated produces no record in enforce or in complain mode.
- Observed on 2026-11-16 in a disposable Debian forky/sid guest (kernel
7.3.4+deb14-cloud-amd64,apparmor_parser5.0.2), as root. The run used the profilesdemo-tanddemo-mntand the test programtfromfindings/security/observed/; the slide writesdemo. The kernel code cited is mainline at the commit the map describes; the guest kernel is one release older and behaved as that code reads.
02 One table lists every question AppArmor answers for security researchers for AppArmor developers
apparmor_hooks[] registers 81 of the kernel's security hooks. File mediation uses the path_* and file_* hooks plus inode_getattr; the other inode_* hooks, file_ioctl, sb_remount and the IPC and key hooks are not registered. Read from the kernel source.
How do you find such a list? Read a table. The kernel defines about 280 questions it can put to a security module: hooks. One array in AppArmor's source says which it answers: 81. For files it answers the path hooks: create, delete, link, rename, change mode and owner, truncate. Then open, and the checks on an open file. Those come with a full path, so a name can be built. The inode hooks, which see only the file, are left out, all but one. That explains most of this deck. For each missing hook, find where the kernel calls it. That's an operation with no rule.
Details and sources
Details
- The hook list is
apparmor_hooks[]with 81LSM_HOOK_INITentries: lsm.c:1785-1891. Every hook the kernel has is declared in lsm_hook_defs.h (about 280). - Registered, by group: ptrace (2),
capableandcapget, mounts (sb_mount,sb_umount,sb_pivotroot,move_mount), tenpath_*hooks,inode_getattr, the file hooks, the process attribute interfaces, about twenty socket hooks, credential and exec hooks,task_setrlimit,task_kill,userns_create, two io_uring hooks, and audit and label conversion helpers. - Not registered and relevant to a profile:
inode_permission,inode_readlink,inode_follow_link,inode_setattr, the xattr and ACL hooks,file_ioctl,file_ioctl_compat,file_fcntl,path_chroot,path_notify,sb_remount,sb_kern_mount, thefs_context_*hooks, all System V IPC hooks,key_*,bpf*,perf_event_*,netlink_send,task_setnice,task_setscheduler,task_prlimit,uring_cmd. - A missing hook is not always a gap: many guard operations that also need a capability (
settime,syslog, module loading, raising priority), and the capability rule is the mediation. - Why path hooks: AppArmor's file rules need a name, and a name can only be built from a mount and a directory entry together. Hooks that receive only an inode cannot provide one.
- This scene is read from the kernel source; the runs are in the following scenes.
03 Everything about a file except its contents
stat is always allowed: the get-attribute permission is set for every state of the file table. access, readlink and chdir have no AppArmor check. Opening the file is checked. Observed, also on a file with an explicit deny rule.
First, what demo can learn. Stat goes through the one inode hook AppArmor does answer. But the permission it asks for, get attributes, is switched on in every row of the permission table, even the row for no match. So the answer is always yes, even under a deny rule. The access call, readlink and change directory have no AppArmor function at all. Here's the run: the secret's size, owner and mode, the link's target, a change into a directory with no rule. Opening a file inside is still denied, under its full name. So a profile can't hide that a file exists, or how it looks from outside.
Details and sources
Details
stat,lstat,statx,fstat: the kernel calls the get-attribute hook, AppArmor matches the name and asks for the get-attribute permission. That bit is set in every entry of a profile's file permission table, including the entry for "no rule matched", so the request cannot fail.accessandfaccessatuse the inode permission hook, which AppArmor does not register. The result is the owner-and-mode answer: in the runaccess R_OK: okon the secret, although opening it for reading is denied.readlinkuses the inode readlink hook (not registered). Run:readlink: ok (6),-> secret.chdirandfchdirhave no path hook. Run:chdir: ok,cwd=/etc/demo/private; thenopen relative "inside": FAILED errno=13withname="/etc/demo/private/inside"in the log.- Walking through a directory on the way to a file is not checked either, so a profile needs no rules for parent directories. Listing a directory is an open and is checked:
name="/etc/demo/private/" requested_mask="r". - With
deny /etc/demo/denied rwkl,in the profile:opendenied,stat: ok,size=12 uid=0 mode=644. - Observed on 2026-11-16 in a disposable Debian forky/sid guest (kernel
7.3.4+deb14-cloud-amd64,apparmor_parser5.0.2), as root. The run used the profilesdemo-tanddemo-mntand the test programtfromfindings/security/observed/; the slide writesdemo. The kernel code cited is mainline at the commit the map describes; the guest kernel is one release older and behaved as that code reads.
Read more
for AppArmor developers for security researchers
Code
apparmor_inode_getattrasks forAA_MAY_GETATTR: lsm.c:460-463.compute_fperms_allowsetsAA_MAY_GETATTRunconditionally, andcompute_fpermsruns it for every state from 0: policy_compat.c:100-103, policy_compat.c:166-169. The parser does the same when it writes the permission table itself (see Permissions in the DFA).- Call sites:
vfs_getattrstat.c:258-267,security_inode_readlinkstat.c:584,chdirandfchdiropen.c:550-590,security_inode_permissionnamei.c:661.
04 Attributes a rule cannot protect
chmod, chown and truncate need w and are checked. Extended attributes, ACLs and timestamps are not: setxattr and utimensat succeed on a file with no rule and on a file with a deny rule. Observed. Ownership and capabilities still apply.
Now what demo can change. Mode, owner and length are covered: they go through path hooks, and you see them denied. Extended attributes and timestamps go through inode hooks that AppArmor doesn't answer. In the run, demo sets an extended attribute on the secret, and on a file with a deny rule for write, and moves the secret's modification time to 1970. Both succeed, with nothing logged. Unix rules still apply: you must own the file, or hold a capability. But demo often does own its files. So no write rule doesn't mean nothing about the file can change. Anything that trusts those attributes is trusting the file's owner.
Details and sources
Details
- Checked, with
w:chmod(operation="chmod"),chown,truncate(operation="truncate"). Run on the secret: bothFAILED errno=13, logged withrequested_mask="w" denied_mask="w". - Not checked:
setxattr,getxattr,listxattr,removexattr, POSIX ACLs (set through the same family of hooks), and timestamp changes withutimensatorfutimens. - Run on the secret (no rule):
getxattr user.note: ok (8),value=original;setxattr user.note=changed: ok (0);utimensat (set atime and mtime to 1970): ok (0). Afterwards, unconfined:user.note="changed"and1970-01-01 00:00:01.000000000 +0000. - The same on
/etc/demo/deniedunderdeny /etc/demo/denied rwkl,:setxattrok,utimensatok, no audit record. - What still applies: timestamps and ACLs need the file's owner or
CAP_FOWNER;user.*attributes need write permission by the file's mode;trusted.*needsCAP_SYS_ADMIN;security.*attributes have their own checks. A confined task has a capability only when its profile has thecapabilityrule. - Why it matters: build systems and backup tools trust timestamps; some access decisions read ACLs and attributes; AppArmor's own
xattrs=attachment condition reads attributes that the owner of an executable can set. - Observed on 2026-11-16 in a disposable Debian forky/sid guest (kernel
7.3.4+deb14-cloud-amd64,apparmor_parser5.0.2), as root. The run used the profilesdemo-tanddemo-mntand the test programtfromfindings/security/observed/; the slide writesdemo. The kernel code cited is mainline at the commit the map describes; the guest kernel is one release older and behaved as that code reads.
for AppArmor developers for security researchers
Code
security_inode_setxattrand siblings: xattr.c:309, xattr.c:461, xattr.c:511, xattr.c:571;security_inode_setattrinnotify_change: attr.c:540. None has an AppArmor function.- The path hooks that are checked:
apparmor_path_truncatelsm.c:350-358,apparmor_path_chmodandapparmor_path_chownlsm.c:450-458.
05 ioctl: once the file is open
File rules decide who gets a descriptor and whether it may be read, written, mapped or locked. ioctl and fcntl are not checked. Observed: FS_IOC_SETFLAGS succeeds on a file opened with only r allowed.
Third, what demo can do with a descriptor it holds. File rules gate getting one: open, exec, inherit, receive. They gate reading, writing, mapping and locking. They say nothing about ioctl calls. There's a hook for those, and AppArmor doesn't answer it. In the run, demo opens the public file with read permission only, then uses an ioctl to change one of the file's flags. It works. On a regular file that's a curiosity. On a device node it's the whole interface. If a profile lets a program open a device, every command that device accepts comes with it. fcntl settings and O_PATH opens are in the same group.
Details and sources
Details
- Checked on an open file:
readandwrite(file_permission),mmapandmprotect(thempermission for executable mappings),flockand POSIX locks (k),ftruncate, and receiving a descriptor from another process. - Not checked:
ioctl(thefile_ioctlhook is not registered),fcntl(file_fcntl:F_SETFL,F_SETOWN, leases, seals), andO_PATHopens (see The limits of name-based mediation). - Run:
open O_RDONLY: ok (3)on/etc/demo/public(rule:r),ioctl FS_IOC_GETFLAGS: ok (0),flags=0x80000,ioctl FS_IOC_SETFLAGS (add noatime) on the read-only fd: ok (0),flags=0x80080; afterwardslsattrprints-------A------e-------. No audit record. Setting that flag needs ownership of the file, which the task had. - For a regular file the ioctls are few (flags, extents, cloning ranges from another descriptor the task also holds). For a device the ioctl interface is the device: terminals, block devices,
/dev/kvm, graphics and input devices. A rule such as/dev/dri/card0 rw,hands over all of it. - What can narrow it: a seccomp filter on ioctl numbers, Landlock's ioctl-on-device right, the device's own permission checks, capabilities for privileged commands.
- Observed on 2026-11-16 in a disposable Debian forky/sid guest (kernel
7.3.4+deb14-cloud-amd64,apparmor_parser5.0.2), as root. The run used the profilesdemo-tanddemo-mntand the test programtfromfindings/security/observed/; the slide writesdemo. The kernel code cited is mainline at the commit the map describes; the guest kernel is one release older and behaved as that code reads.
Read more
for AppArmor developers for security researchers
Code
security_file_ioctl: ioctl.c:592 (compat ioctl.c:648);security_file_fcntl: fcntl.c:603. Neither is inapparmor_hooks[].- What is registered for an open file:
apparmor_file_permissionandapparmor_file_locklsm.c:547-560,common_mmaplsm.c:562-582.
06 Mounts through the new API
AppArmor checks mount(2), umount, pivot_root and move_mount. mount_setattr, an fsconfig reconfigure and a mount built with fsopen and fsmount passed a profile that denies the same thing through mount(2). Observed; all need CAP_SYS_ADMIN.
Mount rules were written for the mount system call. Newer kernels have a second set of calls that work on file descriptors, and current mount tools use them. In this run the profile allows mounting, but denies remounts and the tmpfs type. The classic remount to read-only is refused. mount_setattr does the same job, and succeeds. A reconfigure through fsconfig succeeds. The classic tmpfs mount is refused. Built with fsopen and fsmount, it appears. Nothing is logged. All of these need the sys_admin capability, so a profile without it isn't affected. But a profile that grants it, and then carves out exceptions with mount rules, isn't holding those exceptions.
Details and sources
Details
- Registered mount hooks:
sb_mount(themountsystem call: new mounts, remounts, binds, moves, propagation changes),sb_umount,sb_pivotroot,move_mount. mount_setattr(2)changes per-mount attributes (read-only, nosuid, nodev, noexec, propagation) and calls no security hook.fspickplusfsconfig(FSCONFIG_CMD_RECONFIGURE)changes superblock options and reaches only thesb_remounthook, which AppArmor does not register.fsopen,fsconfig(FSCONFIG_CMD_CREATE)andfsmountcreate a mount that is attached withmove_mount. AppArmor checks that last step as a move with no source, so a rule about a file system type or about flags is not consulted.open_tree(OPEN_TREE_CLONE)plusmove_mountmakes a bind mount the same way.- The run, profile
capability sys_admin, mount, umount, deny remount, deny mount fstype=tmpfs,:mount(MS_REMOUNT|MS_BIND|MS_RDONLY): FAILED errno=13;mount_setattr(MOUNT_ATTR_RDONLY): ok, and/proc/self/mountinfoshows/mnt/x ro,relatime;fspick: ok,fsconfig(FSCONFIG_SET_FLAG, ro): ok,fsconfig(FSCONFIG_CMD_RECONFIGURE): ok, and mountinfo shows the superblockro;mount("none", DIR, "tmpfs"): FAILED errno=13;fsopen(tmpfs): ok,fsconfig(FSCONFIG_CMD_CREATE): ok,fsmount: ok,move_mount onto DIR: ok, and mountinfo shows a tmpfs on/mnt/y. No audit record for the successful calls. - Second profile,
mount,withdeny mount options in (rbind,bind) /mnt/src/ -> **,:mount(SRC, DST, MS_BIND): FAILED errno=13;open_tree(SRC, OPEN_TREE_CLONE): ok,move_mount onto DST: ok. - Known discrepancy: these are two entries of the project's bug list, "Kernel: mount_setattr(2), fsconfig reconfigure and fsopen/fsmount are not checked as remounts or new mounts" and "Kernel: a bind mount made with
open_treeandmove_mountis checked as a move without a source, sodeny mount options in (bind)does not stopmount --bind". Whether they are defects or limits of the hook set is for the maintainers; the behaviour is observed. - What holds: every one of these calls needs
CAP_SYS_ADMINover the mount namespace. A profile with nocapability sys_admin,rule is not affected. A profile with nomountrule at all still refusesmove_mount, so nothing new can be attached, butmount_setattrand a reconfigure go through. - Observed on 2026-11-16 in a disposable Debian forky/sid guest (kernel
7.3.4+deb14-cloud-amd64,apparmor_parser5.0.2), as root. The run used the profilesdemo-tanddemo-mntand the test programtfromfindings/security/observed/; the slide writesdemo. The kernel code cited is mainline at the commit the map describes; the guest kernel is one release older and behaved as that code reads.
Read more
for AppArmor developers for security researchers
Code
- The four mount hooks: lsm.c:1791-1794.
do_mount_setattr(no hook): namespace.c:5102;security_sb_remountinreconfigure_super: super.c:1049;security_sb_kern_mount: fsopen.c:241;open_tree: namespace.c:3376.aa_move_mountdrops a detached source and checks a move: mount.c:424-456.
07 Objects with no rule class
System V IPC and kernel keys have no AppArmor hook: they work under any profile, subject to their own owner and mode. A POSIX message queue is refused as a disconnected file, not by an mqueue rule. Sockets, signals, ptrace and capabilities are mediated. Observed.
For some kinds of object, AppArmor answers no hook at all. System V shared memory and message queues: demo creates them with no rule. Kernel keyrings: the same. What limits them is the object's own owner and mode, and the IPC namespace. POSIX message queues are a surprise in the other direction. The mqueue rule class isn't enforced here. But a queue is a file on an internal mount, so opening one is refused as a disconnected path. And in the same run a plain network socket is denied, because sockets do have rules. So check each class. Capabilities, network, signals, ptrace and mounts are mediated. These are not.
Details and sources
Details
- System V IPC (
shmget,shmat,msgget,semgetand the calls on them): the kernel's hooksipc_permission,shm_*,msg_queue_*andsem_*have no AppArmor function. A shared memory segment is also a file, but on a kernel-internal mount that AppArmor skips. Run:shmget: ok,shmat: ok,msgget: ok. - Kernel keyrings:
key_permissionis not registered. Run:add_key(user, demo): ok. - POSIX message queues: the profile language has an
mqueuerule class, and this kernel has no hook for it (see mqueue rules and Upstream and Ubuntu). The queue is a file on the internalmqueuemount, somq_openreaches the file-open check with a path that does not connect to the root. Run:mq_open /demo-queue: FAILED errno=13andapparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" error=-13 profile="demo-t" name="demo-queue" comm="t" requested_mask="wrc" denied_mask="wrc". - With
flags=(attach_disconnected)and the file rule/demo-queue rw,the samemq_opensucceeds (second run): the queue is then governed by a file rule for a path at the root. - Control in the same run:
socket(AF_INET, SOCK_STREAM): FAILED errno=13,apparmor="DENIED" operation="create" class="net" info="failed af match" ... family="inet" sock_type="stream". - Also without a hook, not run: BPF and perf events (limited by
CAP_BPF,CAP_PERFMON,CAP_SYS_ADMINand two sysctls), changing another process's priority or scheduler (same user orCAP_SYS_NICE), netlink messages after the socket exists. - Observed on 2026-11-16 in a disposable Debian forky/sid guest (kernel
7.3.4+deb14-cloud-amd64,apparmor_parser5.0.2), as root. The run used the profilesdemo-tanddemo-mntand the test programtfromfindings/security/observed/; the slide writesdemo. The kernel code cited is mainline at the commit the map describes; the guest kernel is one release older and behaved as that code reads. - Known discrepancy: a POSIX message queue on a kernel without mqueue mediation is refused as a file with a disconnected path. The same record was made on Debian 13 and Debian sid for a profile with an
mqueuerule and for one without; see Kernel features and the policy ABI.
Read more
for AppArmor developers for security researchers
Code
security_ipc_permission: util.c:571;security_key_permission: permission.c:90. Neither is inapparmor_hooks[].- Internal shmem mounts set
SB_NOUSERshmem.c:5234-5236, andpath_mediated_fsskips such file systems lib.h:146-149. apparmor_socket_create: lsm.c:1258-1304.
08 What a profile promises, then
File rules cover opening, creating, deleting, linking, renaming, and changing mode, owner and length. They do not cover metadata, extended attributes, timestamps or ioctl. Ownership, capability rules and other kernel mechanisms cover those. Unmediated operations are never logged.
So what does a profile promise? With file rules, demo can't open a file to read, write or run it, can't create, delete, link or rename a name, and can't change mode, owner or length, unless a rule allows that name. It doesn't promise demo can't see a file's metadata, change attributes of files it owns, or drive a device it may open. Three things stand behind the gaps. Ownership and mode bits always apply. Most dangerous operations need a capability, and capability rules are enforced. Other mechanisms stack on top, like seccomp and Landlock. One note: none of this is logged, so a trace shows calls the log doesn't.
Details and sources
Details
- Promised by file rules: no open for reading, writing, appending or execution; no executable mapping; no lock; no create, delete, hard link or rename of a name; no change of mode, owner or length; all unless a rule allows the name. And no use of a descriptor inherited from a differently confined parent unless the new profile allows the file.
- Not promised: that metadata and link targets stay hidden; that extended attributes, ACLs and timestamps of files the task owns stay unchanged; that ioctls on descriptors it holds are limited; that descriptors handed over by unconfined tasks are covered; that System V IPC objects and keys are covered; that mount-rule exceptions hold for the file-descriptor mount calls.
- Capabilities are mediated (
capableis in the hook table), and a confined task has a capability only when its profile says so. Changing another user's file, mounting,chroot, raw sockets, loading modules, setting the clock, tracing another user's processes: all need one. - Other layers: ownership and mode bits follow the file, not the name; seccomp can filter system calls and ioctl numbers; Landlock adds object-based file rules; mount, IPC and user namespaces limit what is reachable.
- For profiling: an unmediated operation produces no record in enforce or complain mode.
aa-logprofcannot propose a rule for it and none is needed. The shippedwhoprofile documents such a pair of calls in a comment. - Distribution kernels can differ. See Upstream and Ubuntu.
Read more
for AppArmor developers for security researchers
Code
apparmor_capable: lsm.c:199-215, registered at lsm.c:1789.- The
whoprofile's comment about unmediated calls: who:14-24.
09 Where to go from here
Next: sec-path-limits, syn-access-modes, syn-capability, syn-mount, prac-privileged, upstream-and-ubuntu, k-overview.
That's the list for this kernel: file metadata, extended attributes and timestamps, ioctl, the newer mount calls, System V IPC and keys. Each one is a missing hook, a call that asks nobody, or a check that always passes. From here, the name limits deck covers the other half: what happens when the name itself moves. The access modes deck shows what the permission letters do cover, and the capability deck covers the rule class that stands behind most of these gaps. If you're profiling a privileged program, the deck on security-sensitive programs explains why the log alone isn't enough.
Details and sources
Details
- Not mediated in this kernel: reading file metadata,
access,readlink,chdir; extended attributes, ACLs and timestamps;ioctlandfcntl;O_PATHopens;mount_setattr,fsconfigreconfigure and mounts built withfsopenandfsmount; System V IPC and kernel keys. - Each is one of: no AppArmor function for the hook, no hook in the kernel, or a check that always passes.
What each deck answers:
- The limits of name-based mediation: bind mounts, renames, open descriptors, disconnected paths.
- Access modes: the operations each permission letter covers.
- The capability rule: the rule class behind most of the gaps.
- Mount rules and mqueue rules.
- Profiles for security-sensitive programs: the log and a trace together.
- Upstream and Ubuntu: what distribution kernels add.
- The kernel side at a glance, Reading a denial, Known bugs, the threat model.
Read more
Basis of the statements on this page: "observed" means run on 2026-11-16 in a disposable Debian forky/sid guest (kernel 7.3.4+deb14-cloud-amd64, apparmor_parser 5.0.2), as root, with the profiles and the test program kept in findings/security/observed/. "Code" means read from the kernel source at the commit the map describes and not run. The guest kernel is a distribution kernel one release older than that source; every observation agrees with the code cited in the scenes. Distribution kernels with extra AppArmor patches can differ: see Upstream and Ubuntu.
Operations and what checks them
| Operation | AppArmor | Why | Basis | What still applies |
|---|---|---|---|---|
open for read, write, append | checked | file_open | observed | |
| listing a directory | checked (an open) | file_open | observed | |
chmod, chown, truncate | checked, need w | path_chmod, path_chown, path_truncate | observed | |
create, delete, mkdir, rmdir, mknod, symlink | checked | path_* hooks | code | |
| hard link, rename | checked | path_link, path_rename | observed (rename) | |
mmap with PROT_EXEC, mprotect | checked, need m | mmap_file, file_mprotect | code | |
flock, POSIX locks | checked, need k | file_lock | code | |
stat, fstat, statx | always allowed | get-attribute bit set in every table entry | observed | search permission on the directories |
access, faccessat | not checked | inode_permission not registered | observed | owner and mode |
readlink | not checked | inode_readlink not registered | observed | |
chdir, fchdir | not checked | no path hook | observed | search permission |
| walking through directories | not checked | inode_permission not registered | code | search permission |
open(O_PATH) | not checked | the kernel returns before the hook | observed | |
getxattr, listxattr | not checked | xattr hooks not registered | observed | mode; attribute namespace rules |
setxattr, removexattr, ACLs | not checked | xattr and ACL hooks not registered | observed (setxattr) | owner, mode, CAP_FOWNER, CAP_SYS_ADMIN for trusted.* |
utimensat, futimens | not checked | inode_setattr not registered | observed | owner or CAP_FOWNER |
ioctl | not checked | file_ioctl not registered | observed | the driver's own checks; capabilities |
fcntl | not checked | file_fcntl not registered | code | |
mount(2), umount, pivot_root, move_mount | checked | sb_mount, sb_umount, sb_pivotroot, move_mount | observed (mount) | CAP_SYS_ADMIN |
mount_setattr | not checked | no hook in the kernel | observed | CAP_SYS_ADMIN |
fsconfig reconfigure | not checked | sb_remount not registered | observed | CAP_SYS_ADMIN |
fsopen + fsmount | checked only as a move at move_mount | sb_kern_mount, fs_context_* not registered | observed | CAP_SYS_ADMIN |
open_tree(OPEN_TREE_CLONE) | checked only as a move at move_mount | no hook | observed | CAP_SYS_ADMIN |
| System V shm, msg, sem | not checked | IPC hooks not registered | observed (shm, msg) | object owner and mode; IPC namespace |
| kernel keys | not checked | key_permission not registered | observed | key permissions |
| POSIX message queue | refused as a disconnected file | no mqueue hook; the queue is a file on an internal mount | observed | |
| sockets, signals, ptrace, capabilities, rlimits, exec, user namespace creation | checked | their own hooks and rule classes | observed (inet socket), code |
- Known discrepancy: a POSIX message queue on a kernel without mqueue mediation is refused as a file with a disconnected path. The row above is that case; the same record on Debian 13 and Debian sid, with and without an
mqueuerule, is in Kernel features and the policy ABI.
What a file rule covers, by letter
| Letter | Covers | Does not cover |
|---|---|---|
r | open for reading, reading a directory | stat, readlink, getxattr (never checked) |
w | open for writing, create, delete, rename, chmod, chown, truncate | setxattr, ACLs, timestamps, ioctl |
a | open for appending | |
l | creating a hard link at this name | |
k | file locks | |
m | executable mappings | |
x with a mode | execution |
Reading a trace next to a log
An operation in the "not checked" rows never appears in the audit log, in enforce or in complain mode. When strace shows such a call and aa-logprof proposes nothing for it, the profile is complete as far as AppArmor is concerned.
for AppArmor developers for security researchers
Code map
| What | Where |
|---|---|
| the hook table | apparmor_hooks[], linux:security/apparmor/lsm.c:1785-1891 |
| every hook the kernel defines | linux:include/linux/lsm_hook_defs.h |
| get-attribute always allowed | compute_fperms_allow, linux:security/apparmor/policy_compat.c:100-103 |
| file systems skipped | path_mediated_fs, linux:security/apparmor/include/lib.h:146-149 |
O_PATH | linux:fs/open.c:951-956 |
| xattr hooks | linux:fs/xattr.c:309, 461, 511, 571 |
| setattr hook | linux:fs/attr.c:540 |
| ioctl and fcntl hooks | linux:fs/ioctl.c:592, linux:fs/fcntl.c:603 |
mount_setattr | linux:fs/namespace.c:5102 |
| remount hook | linux:fs/super.c:1049 |
| move_mount as checked by AppArmor | linux:security/apparmor/mount.c:424-456 |
Roads from here
START HERE
- Upstream and Ubuntu kernels — what distribution kernels add
FILE ACCESS
- File access modes — the operations the letters do cover
RULE CLASSES
- Capability rules — the rule class that stands behind most gaps
- Mount rules — the mount rules and the call they describe
- Message queue rules — the message queue rule class and who enforces it
IN PRACTICE · security-sensitive programs
- Profiles for security-sensitive programs — finding every operation of a privileged program
SECURITY · threat model and limits
- The limits of name-based mediation — where the name itself fails
- Bugs found while building this map (no slides yet) — defects as opposed to limits
- AppArmor's threat model (no slides yet) — what AppArmor is meant to stop
RUNNING THE PARSER
- Reading a denial — what does get logged
IN THE KERNEL
- AppArmor in the kernel (no slides yet) — the hook table in the kernel