How the kernel checks an access
a profile as a state machine for everyone
A real profile compiled into a state machine, and the kernel walking it character by character to answer one request. The widget under the deck lets you walk the same machine with your own paths.
On the map: start here
▶ Watch this deck — 10 scenes, ~8 min
Part of journeys
- New to AppArmor, step 9 of 10 · previous: allow and deny · next: Reading a denial
- From profile text to kernel tables, step 5 of 13 · previous: From AARE to regular expressions · next: The backend pipeline
- How a rule becomes a permission, step 1 of 12 · next: File access modes
01 One question, on every open
The kernel holds no profile text. apparmor_parser compiles the file rules into one state machine when the profile is loaded, and each check is a walk over it.
Demo opens its configuration file, and the kernel has one question to answer: may it? That question comes up on every open, so the answer has to be quick. Here is the profile we'll use, with four file rules. You might picture the kernel reading those lines and trying one rule after another. It doesn't. There is no profile text in the kernel. Before the program ran, the parser turned the rules into one small machine, and that is what the kernel walks. This deck shows you that machine, the real one, and it's for everyone. One scene near the end is for people who read the code.
Details and sources
Details
- The profile used in this deck, complete:
abi <abi/5.0>,
profile demo /usr/bin/demo {
audit /etc/demo.conf r,
/etc/demo/* r,
deny /etc/demo/secret r,
owner /run/demo/** rw,
}
- Everything drawn in this deck comes from compiling that profile with the parser of the AppArmor tree and reading the tables back from the binary policy it writes with
-S. The steps and the full state table are in the reference under the deck. - The check for an open starts at the
file_openhook,apparmor_file_open(lsm.c:465), and ends in__aa_path_perm(file.c:233-251), which walks the machine and compares the result with the request. - An unconfined process is not checked: the hook tests
if (!unconfined(label))first (lsm.c:488).
Read more
- apparmor.d(5), File Rules and Globbing.
- The pipeline: where the machine is built and how it is loaded. Why AppArmor: what else the kernel checks.
- The widget under this deck walks the same machine with any path you type.
for AppArmor developers for security researchers
In the code
- The file rules are compiled by
process_profile_regex; the file machine is created at parser_regex.c:797. - The same profile also yields a 15-state machine for the attachment
/usr/bin/demoand a 5-state machine for the rule classes. This deck draws only the file machine.
02 Four rules, one machine
All file rules of a profile become one machine: 34 states here. Rules with a common beginning share states. A check costs one step per character of the path, whatever the number of rules.
The parser reads all four rules and builds a single machine from them. Not four machines: one. Rules that begin the same way share their beginning. Three of ours start with /etc/demo, so they walk the same states and split only where they differ: one goes on to the config file, one into the directory, and the deny rule takes a side track there. The fourth rule branches off right after the first slash. That makes thirty-four states. And however many rules a profile has, a check takes one step per character of the path, whether there are four rules or four thousand.
Details and sources
Details
- The machine has 34 states: 33 that some path can reach, and state 0, which means no match. The parser reports it with
-D dfa-stats:Created dfa: states 34andDfa minimization no states removed: partitions 34. - States 1, 2, 3, 5, 7, 9, 11, 13, 15 and 17 spell
/etc/demoand are shared by three rules. States 4 to 18 (even numbers) spell/run/demo. - The numbers in the circles are the state numbers of the compiled table; the widget under the deck uses the same numbers.
- The cost of a check is the length of the path: the kernel does one lookup per byte and has no loop over rules (match.c:518-548).
- The number of rules still matters for the size of the machine and for the time the parser needs to build it.
Read more
- Globbing and file rules for what the rules mean.
- wiki: TechnicalDoc_HFA: how the compiler works.
for AppArmor developers for security researchers
In the code
- Each rule is first rewritten as a regular expression.
-D rule-exprsprints them:/etc/demo/*becomes/etc/demo/[^/\x00][^/\x00]*(parser_regex.c:204, parser_regex.c:225) and/run/demo/**becomes/run/demo/[^/\x00][^\x00]*(parser_regex.c:220). - Building the DFA follows the construction; minimization explains why no state could be removed here.
03 States and edges
A state stands for what has been read so far; an edge says where to go for one character. The walk starts in state 1. A character without an edge leads to state 0, and state 0 has no way out.
A state is a circle. It stands for what has been read so far. An edge is an arrow with a character on it: if the next character of the path is this one, go there. We begin in state one, with nothing read. Its only edge is a slash. State two has two edges: e, on the way to /etc, and r, on the way to /run. And if the next character is something else, an h for /home? There's no edge for it. That drops us into state zero, which means no rule can match any more. Nothing leads back out of it.
Details and sources
Details
- The start state is 1 and the no-match state is 0:
DFA_STARTandDFA_NOMATCH(match.h:17-18). - State 1 has one edge,
/. State 2 has two,eto state 3 andrto state 4. Every other byte in states 1 and 2 leads to state 0. - A machine like this has exactly one next state for every state and every character. That is what makes it deterministic: there is nothing to choose and nothing to retry.
- State 0 leads only to itself, so once the walk is there the answer is fixed.
Read more
- The full table of states and edges is in the reference under the deck.
for AppArmor developers for security researchers
In the code
- "No edge" is not a special case in the kernel. Each state has a default next state, used for every byte it has no entry for; for most states of this machine the default is 0 (match.c:443-455).
04 Walking a path
The kernel reads the path one byte at a time and follows one edge per byte. /etc/demo.conf takes 14 steps and ends in state 30. A path no rule covers ends in state 0.
Now watch the kernel walk. Demo opens /etc/demo.conf. The kernel reads that path from the left, one character at a time. Slash: state one to state two. Then e, t, c: three more steps. For each character it follows one edge, and that's all. It doesn't go back, and it doesn't try alternatives. Fourteen characters, fourteen steps, and the walk stops in state thirty. Now a path that no rule covers, a key under /home. Slash, then h, and we are in state zero. That's where the walk stays, all the way to the end of the path.
Details and sources
Details
- The walk for
/etc/demo.conf: 1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 22, 26, 28, 30. - The walk for
/home/user/.ssh/id_rsa: 1, 2, then 0 for each of the remaining 20 characters. The kernel does not stop early; it reads the whole path (match.c:541-546). - The path that is matched is the one the kernel builds for the opened object: absolute, with symbolic links already followed. It is not the string the program passed to
open()(path.c:202). - A directory's name gets a trailing slash, so the directory
/etc/demois matched as/etc/demo/(path.c:167-177).
Read more
- Symbolic links and hard links: what name-based matching means in practice.
- Path limits: paths the kernel cannot name.
for AppArmor developers for security researchers
In the code
aa_str_permscallsaa_dfa_match(file_rules->dfa, start, name)(file.c:221-231). The loop iswhile (*str): the terminating NUL ends the walk.- The start state is
rules->file->start[AA_CLASS_FILE](file.c:244), which is 1 unless the policy carries adfa_startfield (policy_unpack.c:1029-1031). - Matching at run time covers the other entry points, such as
aa_dfa_match_lenandaa_dfa_leftmatch.
05 A wildcard is a loop
* compiles to a state that loops on every character except /; ** to one that loops on every character. Both need at least one character first, so /etc/demo/ itself matches neither.
What about wildcards? A star becomes a loop. After /etc/demo and one more slash, we're in state twenty. Any character except a slash takes us on to state twenty-three, and that state has an edge that leads straight back to itself: any character except a slash, stay here. m, o, t, d: four times around. A slash has no edge here, so a file one directory deeper drops to state zero. That is all it means that a star doesn't cross a slash. Two stars make the same shape with a wider loop: in state twenty-five every character, slashes too, keeps you there.
Details and sources
Details
/etc/demo/motd: the walk reaches state 20 after/etc/demo/, state 23 withm, and stays in 23 foro,t,d./etc/demo/sub/x:sleads to state 24 (the first state of the side track forsecret),uto 23,bstays, and the second/has no edge: state 0./etc/demo/alone stops in state 20, which carries no permissions:*and**at the end of a rule both need at least one character after the slash./run/demo/cache/db: state 21 after/run/demo/, state 25 withc, and every further character, slashes included, stays in 25.- The first character after the slash may not be a slash in either rule.
Read more
- Globbing:
?,[...],{a,b}and the slash rules. apparmor.d(5), Globbing.
for AppArmor developers for security researchers
In the code
- At the end of a pattern and after a slash,
*is emitted as[^/\x00]followed by[^/\x00]*(parser_regex.c:204, parser_regex.c:225), and**as[^/\x00]followed by[^\x00]*(parser_regex.c:220). The NUL byte is kept out of every class because it separates the parts of multi-part matches.
06 Where the path ends
Permissions are attached to states. Only the state the path ends in counts: 30 carries read (with audit), 23 read, 25 read and write for the owner, and most states nothing.
Reading the path gives the kernel a state number, and nothing more. The answer is attached to that state. Some states carry permissions; they're drawn with a double ring. State thirty, where the config file ends, carries read. State twenty-three, the star loop, carries read too. State twenty-five carries read and write. Most states carry nothing. Stop in state twenty, having read the directory name and its slash but no file name, and nothing is allowed. So only the state where the path ends counts. The states you passed on the way there don't.
Details and sources
Details
- Nine of the 34 states carry permissions: 30 (
/etc/demo.conf), 23 and the five states 24, 27, 29, 31, 32 (names under/etc/demo/), 25 (anything under/run/demo/), and 33 (/etc/demo/secret, where the deny rule applies). - A rule that says
rgives more than the read bit: the compiled entry also allows opening the file and reading its attributes.rwadds write, append, create, delete, and changing attributes, mode and owner. - The kernel's decision is one comparison: is every requested permission in the allowed set of the final state (file.c:246-247)?
Read more
- Access modes: what each letter of a file rule allows.
for AppArmor developers for security researchers
In the code
- The final state is an index into the accept table, whose value is an index into the profile's permission table (
aa_lookup_condperms, file.c:194-209). The table for this machine has 12 entries; the reference under the deck lists them. - The permission bits are in perms.h:16-39. The entry of state 23 has
allow0x244:AA_MAY_GETATTR,AA_MAY_OPEN,MAY_READ. - Permissions in the DFA shows how the parser computes these sets.
07 Owner, other and deny
Each state has an owner set and an other set; the kernel picks by comparing the process's fsuid with the file's owner. A deny rule compiles to states of its own in which the permission is absent.
Two refinements. First, owner. Each state really carries two sets of permissions: one for when the file belongs to the user demo runs as, and one for when it doesn't. State twenty-five has read and write in the owner set and nothing in the other. The kernel compares the two user IDs and picks. Second, deny. The deny rule adds a side track inside the star rule: s, e, c, r, e, t. Every state along it still allows read, because a file called sec is just a file. Only the last one, the exact name, has read taken out. One more character, and you're back in the loop.
Details and sources
Details
- Owner: the kernel compares the filesystem uid of the process (
fsuidin the log) with the uid that owns the file (ouid). Equal: the owner set. Different: the other set. - State 25: the owner set has read and write; the other set allows neither. A rule without
ownerputs the same permissions in both sets. - Deny: the states reached by
/etc/demo/s,se,sec,secrandsecreare 24, 27, 29, 31 and 32. All of them carry read, from the*rule. State 33, reached by/etc/demo/secret, does not. /etc/demo/secretsleaves state 33 for state 23 with its last character: read is allowed again.- In the compiled entry of state 33 there is no "deny" mark. Read is simply missing from the allowed set, and it is marked quiet, which matters for the log (next scene).
Read more
- The owner qualifier, allow and deny and priority, which can change which rule wins.
for AppArmor developers for security researchers
In the code
aa_lookup_condpermsreturnsperms[index]whenuid_eq(subj_uid, cond->uid)andperms[index + 1]otherwise, for states whose accept2 entry hasACCEPT_FLAG_OWNER(file.c:202-206). The subject uid iscurrent_fsuid()(file.c:227);cond->uidis the inode's owner (lsm.c:492-496).- State 33 uses entries 2 and 3:
allow0x200 (AA_MAY_GETATTRonly),quiet0x244,deny0.
08 The decision and the log line
Requested permissions outside the allowed set fail with EACCES and are logged as DENIED. An allowed access is logged as AUDIT only if the rule said audit. A deny rule refuses without a log line.
Now the kernel holds two things: what demo asked for, and what the state allows. It compares them. Demo asked to read its config file. Read is allowed, so the open goes ahead. That rule also said audit, so the kernel writes a log line marked AUDIT. Had demo asked to write, write isn't in the set. The open fails with permission denied, and the log line says DENIED, with the name and the permission that was refused. And the secret file? Refused too, but silently: a deny rule also marks the permission as quiet. Under this deck there's a widget where you can try all of it yourself.
Details and sources
Details
- The three lines, in full, as the kernel's format gives them for these requests (composed, not captured;
pidandcommare invented, and a real record starts withaudit: type=1400 audit(time:serial):):
apparmor="AUDIT" operation="open" class="file" profile="demo" name="/etc/demo.conf" pid=4242 comm="demo" requested_mask="r" fsuid=1000 ouid=0 apparmor="DENIED" operation="open" class="file" profile="demo" name="/etc/demo.conf" pid=4242 comm="demo" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0
- Reading
/etc/demo/secretreturnsEACCESand writes nothing. Writingaudit denyin the rule would bring the line back. - A path that no rule covers is refused and logged: the entry used for it has nothing marked quiet.
- This is enforce mode. In complain mode the same refusal is let through and logged as
ALLOWED. - In a denial,
requested_maskholds only the refused part of what was asked.
Read more
for AppArmor developers for security researchers
In the code
__aa_path_perm:if (request & ~perms->allow) e = -EACCES;thenaa_audit_file(file.c:246-250).aa_audit_file: an allowed request is masked withperms->auditand logged asAUDIT_APPARMOR_AUDITif anything remains (file.c:119-130); a refused one is reduced to the bits outsideallow, loses itsquietbits, and is logged if anything remains (file.c:131-150).- The fields are written by
audit_pre(audit.c:93-141) andfile_audit_cb(file.c:45-67).
09 Four arrays for AppArmor developers for security researchers
match_char: pos = base[state] + c; if check[pos] == state the next state is next[pos], otherwise default[state]. accept[state] then indexes the permission table.
If you read the code: the machine is four arrays, and one step is a few lines in a macro called match_char. Take the state's entry in base, add the byte, and look at that position in check. If check holds our state number, next gives the new state. If it doesn't, default does. In state seventeen, a slash lands on position fifty-one; check says seventeen, so next says twenty. In state twenty, an m misses, and default says twenty-three. After the last byte, accept turns the final state into an index into the permission table, and a flag in accept2 marks an owner and other pair.
Details and sources
Details
match_charis at match.c:443-455.base_idxkeeps the low 24 bits of a base entry (match.c:23); the high bits are flags (match.h:196-202).- If the base entry has
MATCH_FLAG_DIFF_ENCODE, a miss repeats the lookup from the default state with the same byte instead of ending the step. The tables of this machine do not use it: their header flags are 0. - Rows overlap in
nextandcheck: each state's row is placed at an offset (base) where its entries do not collide with others, andcheckrecords the owner of each slot. For this machine 34 states with 256 possible bytes each fit in 275 slots. - States 20, 23, 24, 27, 29, 31, 32 and 33 have default 23; states 21 and 25 have default 25. They carry explicit entries for
/and for the NUL byte that lead to state 0. accept[state]is the index of the state's permission entry; withACCEPT_FLAG_OWNERinaccept2[state](policy.h:61-63) the next entry is the one for non-owners (file.c:197-206).- Each permission entry is an
aa_permsrecord unpacked from 14 u32 fields (policy_unpack.c:901-923). - The kernel verifies the tables when the policy is loaded, so the walk needs no bounds checks.
Read more
- Table compression: how the parser packs the rows. The binary policy. Matching at run time. Unpacking policy.
- wiki: TechnicalDoc_HFA_Layout.
10 Where to go from here
Next: the pipeline for where the machine comes from, globbing and file rules for the language, the DFA engine decks for the compiler, matching at run time for the kernel code, reading a denial for the log.
That's a check, start to finish: one machine, one step per character, one state at the end, and its permissions against what was asked. From here, the pipeline shows where this machine is built and how it reaches the kernel. Globbing and file rules cover what you can write in a profile. If you want to know how the parser makes the states, and how deny, audit and priority become permissions, there are two decks in the DFA engine district. Matching at run time is the kernel code itself. And reading a denial takes the log line apart field by field.
Details and sources
Details
- The widget under this deck uses the tables of the compiled profile. Its walk, its choice of permission entry and its log lines follow the kernel functions named in the earlier scenes.
- The same kind of machine answers the other checks as well: capabilities, network, mount, signals and the rest are matched by a second machine in the same profile, and attachment by a third.
Read more
The profile
abi <abi/5.0>,
profile demo /usr/bin/demo {
audit /etc/demo.conf r,
/etc/demo/* r,
deny /etc/demo/secret r,
owner /run/demo/** rw,
}
The four file rules compile to one machine with 34 states. Everything below was read back from the binary policy that apparmor_parser writes for this profile.
Every state
"Reached by" is the shortest input that leads to the state. A byte that is not listed leads to state 0. "Accept" is the state's index into the permission table; for the other half add 1.
| State | Reached by | Edges | Accept | Carries |
|---|---|---|---|---|
| 0 | (no match) | none: every byte stays in 0 | 0 | |
| 1 | (start) | / → 2 | 0 | |
| 2 | / | e → 3, r → 4 | 0 | |
| 3 | /e | t → 5 | 0 | |
| 4 | /r | u → 6 | 0 | |
| 5 | /et | c → 7 | 0 | |
| 6 | /ru | n → 8 | 0 | |
| 7 | /etc | / → 9 | 0 | |
| 8 | /run | / → 10 | 0 | |
| 9 | /etc/ | d → 11 | 0 | |
| 10 | /run/ | d → 12 | 0 | |
| 11 | /etc/d | e → 13 | 0 | |
| 12 | /run/d | e → 14 | 0 | |
| 13 | /etc/de | m → 15 | 0 | |
| 14 | /run/de | m → 16 | 0 | |
| 15 | /etc/dem | o → 17 | 0 | |
| 16 | /run/dem | o → 18 | 0 | |
| 17 | /etc/demo | . → 19, / → 20 | 0 | |
| 18 | /run/demo | / → 21 | 0 | |
| 19 | /etc/demo. | c → 22 | 0 | |
| 20 | /etc/demo/ | [^\x00/s] → 23, s → 24 | 0 | |
| 21 | /run/demo/ | [^\x00/] → 25 | 0 | |
| 22 | /etc/demo.c | o → 26 | 0 | |
| 23 | /etc/demo/a | [^\x00/] → 23 | 8 | r |
| 24 | /etc/demo/s | [^\x00/e] → 23, e → 27 | 8 | r |
| 25 | /run/demo/a | [^\x00] → 25 | 6 | owner rw |
| 26 | /etc/demo.co | n → 28 | 0 | |
| 27 | /etc/demo/se | [^\x00/c] → 23, c → 29 | 8 | r |
| 28 | /etc/demo.con | f → 30 | 0 | |
| 29 | /etc/demo/sec | [^\x00/r] → 23, r → 31 | 8 | r |
| 30 | /etc/demo.conf | none | 10 | r audit |
| 31 | /etc/demo/secr | [^\x00/e] → 23, e → 32 | 8 | r |
| 32 | /etc/demo/secre | [^\x00/t] → 23, t → 33 | 8 | r |
| 33 | /etc/demo/secret | [^\x00/] → 23 | 2 | deny r |
The permission table
Entries come in pairs: the even one is used when the file's owner is the user the process runs as, the odd one otherwise. getattr is present in every entry.
| Entry | allow | audit | quiet | Used by |
|---|---|---|---|---|
| 0 | getattr | states without permissions (25 of them), owner | ||
| 1 | getattr | states without permissions (23 of them), other | ||
| 2 | getattr | read, open, getattr | states 33, owner | |
| 3 | getattr | read, open, getattr | states 33, other | |
| 4 | getattr | read, open, getattr | no state | |
| 5 | getattr | read, open, getattr | no state | |
| 6 | write, read, append, create, delete, open, setattr, getattr, chmod, chown | states 25, owner | ||
| 7 | getattr | states 25, other | ||
| 8 | read, open, getattr | states 23, 24, 27, 29, 31, 32, owner | ||
| 9 | read, open, getattr | states 23, 24, 27, 29, 31, 32, other | ||
| 10 | read, open, getattr | read, open, getattr | states 30, owner | |
| 11 | read, open, getattr | read, open, getattr | states 30, other |
Requests to try
demo runs as user 1000. "owner" means the file belongs to user 1000, "other" that it belongs to user 0. Each row was computed from the compiled tables with the kernel's rules; the widget shows the same results.
| Request | File is | Final state | Entry | Outcome | Log record |
|---|---|---|---|---|---|
read /etc/demo.conf | other | 30 | 11 | allowed and logged | apparmor="AUDIT" |
write /etc/demo.conf | other | 30 | 11 | denied | apparmor="DENIED" |
read /etc/demo/motd | other | 23 | 9 | allowed | none |
read /etc/demo/sub/x | other | 0 | 0 | denied | apparmor="DENIED" |
read /etc/demo/secret | other | 33 | 3 | denied quietly | none |
read /etc/demo/secrets | other | 23 | 9 | allowed | none |
read /etc/demo/ | other | 20 | 1 | denied | apparmor="DENIED" |
write /run/demo/cache/db | owner | 25 | 6 | allowed | none |
write /run/demo/cache/db | other | 25 | 7 | denied | apparmor="DENIED" |
read /home/user/.ssh/id_rsa | owner | 0 | 0 | denied | apparmor="DENIED" |
exec /usr/bin/demo-helper | other | 0 | 0 | denied | apparmor="DENIED" |
How the kernel decides
- The
file_openhook maps the open flags to a request: read, write, append, create. - The kernel builds the path of the object and walks the machine from state 1, one byte per step.
- The final state's accept value, plus 1 if the file belongs to someone else, selects a permission entry.
- If the request has a bit that is not in
allow, the open fails withEACCES. - Allowed: a log record (
AUDIT) only for bits that are inaudit. - Refused: a log record (
DENIED) unless every refused bit is inquiet.
for AppArmor developers for security researchers
Reproducing the machine
tools/head-parser -Q -K --skip-kernel-load -D rule-exprs -D dfa-stats -D dfa-states -D compressed-dfa demo.sd tools/head-parser -S -K demo.sd > demo.bin tools/matching-demo.py demo.sd demo.bin > site/matching-demo.json
-D dfa-statesprints the states and their edges,-D compressed-dfathe packed tables,-Sthe binary policy. The feature set isabi/5.0.tools/matching-demo.pyunpacks the file machine from the binary policy and walks it with a port ofmatch_char.- Header of the compiled tables: flags 0 (no diff-encoding), no equivalence classes; accept, accept2 and base are 32 bits wide, default, next and check 16 bits; next and check have 275 entries.
for AppArmor developers for security researchers
The packed tables
| Table | Values |
|---|---|
| base | 7:1, 8:2, 10:2, 11:2, 12:3, 14:2, 15:1, 16:2, 17:4, 18:5, 19:6, 20:6, 21:7, 22:4, 23:8, 24:17, 25:1, 26:9, 27:9, 28:4, 29:10, 31:19, 32:11, 33:12; 0 for the rest |
| default | 20:23, 21:25, 23:23, 24:23, 25:25, 27:23, 29:23, 31:23, 32:23, 33:23; 0 for the rest |
| accept | 23:8, 24:8, 25:6, 27:8, 29:8, 30:10, 31:8, 32:8, 33:2; 0 for the rest |
| accept2 | 0 for states 0 and 1, 1 for all others |
Entries of next and check that belong to a state (position: check → next):
1: 25 → 0 6: 20 → 0 7: 21 → 0 8: 23 → 0 9: 27 → 0 10: 29 → 0 11: 32 → 0 12: 33 → 0 17: 24 → 0 19: 31 → 0 47: 1 → 2 48: 7 → 9 49: 8 → 10 50: 17 → 19 51: 17 → 20 52: 18 → 21 53: 20 → 0 54: 21 → 0 55: 23 → 0 56: 27 → 0 57: 29 → 0 58: 32 → 0 59: 33 → 0 64: 24 → 0 66: 31 → 0 99: 5 → 7 100: 9 → 11 101: 2 → 3 102: 10 → 12 103: 11 → 13 104: 12 → 14 105: 19 → 22 106: 28 → 30 108: 27 → 29 109: 13 → 15 110: 6 → 8 111: 14 → 16 112: 15 → 17 113: 16 → 18 114: 2 → 4 115: 22 → 26 116: 3 → 5 117: 4 → 6 118: 24 → 27 119: 26 → 28 120: 31 → 32 121: 20 → 24 124: 29 → 31 127: 32 → 33
Roads from here
START HERE
- From profile text to kernel — where this machine is built and how it reaches the kernel
FILE ACCESS
- Globbing (AARE) — every wildcard and what it matches
- File rules — paths and permissions in a file rule
RUNNING THE PARSER
- Reading a denial — every field of the log line
IN THE KERNEL
- Matching at run time — the kernel code that walks the tables
THE DFA ENGINE · libapparmor_re
- Building the DFA — how the parser builds the states
- Permissions in the DFA — how deny and audit and priority become permissions on a state