The prompt qualifier

ask before allowing for application developers

prompt marks permissions for which a user-space agent should be asked. The parser compiles and packs them. Mainline Linux 7.4 unpacks the prompt permissions and does not act on them so there the access is refused like any permission that is not allowed.

On the map: qualifiers

▶ Watch this deck — 7 scenes, ~5 min

Worth seeing first

  • allow and deny — allow and deny, the two words prompt shares a seat with

01 Neither yes nor no: ask

THE PROMPT QUALIFIER demo /home/user/Documents/report.odt open @{HOME}/Documents/** r, always yes deny @{HOME}/Documents/** r, always no prompt @{HOME}/Documents/** r, ask agent: "Let demo read report.odt?" user space the kernel: the prompt permissions are loaded and not used this deck: what the parser does, and what the kernel does
The program demo opens a document under the user's home. An allow rule always says yes, a deny rule always says no, and a prompt rule would have an agent ask the user. The line to the agent is dashed and cut: the kernel loads the prompt permissions and does not use them.

prompt RULE, marks permissions to be decided by a user-space agent. The kernel unpacks them and does not act on them.

Should demo be able to read your documents? Sometimes the honest answer is: it depends. Ask the user when it happens. The profile language has a word for that. Prompt sits in the same seat as allow and deny, and the idea is that the kernel pauses the access and asks an agent in user space. Here's the catch, and you need it before you write the rule. The kernel loads prompt permissions and does nothing with them. Asking needs a kernel that carries extra patches. This deck shows what the parser does, and what the kernel does.

Details and sources

Details

  • prompt is a qualifier in the access type seat of a rule, where allow and deny go. The example rule prompt @{HOME}/Documents/** r, is line 29 of the map's example profile for demo.
  • Intended meaning: the permission is neither granted nor refused by the profile; a user-space agent is asked when the access happens. The agent on the slide is drawn dashed and unnamed because neither source tree read for this map contains code that delivers such a request.
  • The kernel (commit 97d73c825): the permission set has a prompt field (perms.h:78); it is read from the loaded policy and no access decision reads it (lib.c:425-464). This was read from the kernel source, not observed on a running kernel.
  • The parser (AppArmor 836052d21) compiles prompt rules without a warning whatever the kernel supports.

for AppArmor developers for security researchers

Code

Read more

02 The third word for the third seat

GRAMMAR priority=N audit allow deny prompt owner | other RULE , one of the three prompt @{HOME}/Documents/** r, audit prompt signal, prompt owner /var/lib/demo/** rw, audit before, owner after prompt { /foo r, audit /bar w, owner /baz rw, } a block from the tree's equality tests: equal to three separate prompt rules the man page's ACCESS TYPE lists only allow and deny; the parser accepts all three
Syntax diagram of the four qualifier seats: priority=N, audit, the access type with prompt highlighted next to allow and deny, and owner or other, followed by the rule. Below it a prompt rule, audit prompt and prompt owner rules, and a prompt block from the parser's equality tests.

[priority=N] [audit] prompt [owner|other] RULE,. One access type per rule: allow, deny or prompt.

Prompt takes the access type seat. So a rule has allow, or deny, or prompt, and only one of them. Audit goes before it and owner after it, as usual. You can also put it in front of a block. There's no simple test file for prompt in the tree. This block comes from the parser's equality tests, which check that a prompt block and three separate prompt rules compile to the same policy. And if you look in the manual's grammar, the access type line lists only allow and deny, though the block examples there do use prompt.

Details and sources

Details

  • Form: [priority=N] [audit] prompt [owner|other] RULE, and prompt { RULES }. The order of the qualifiers is fixed.
  • One access type per rule: allow, deny or prompt. Two of them on one rule is a syntax error (run with the tree's parser at 836052d21).
  • profile t { prompt /foo r, audit prompt signal, prompt capability chown, } is accepted (run with the tree's parser; nothing was loaded into a kernel). See the reference below before using prompt on capability rules.
  • No file under parser/tst/simple_tests/ uses a prompt rule. The block on the slide is from the equality tests, which check that /t { prompt { /foo r, audit /bar w, owner /baz rw, } } and /t { prompt /foo r, audit prompt /bar w, prompt owner /baz rw, } compile to the same binary policy: equality.sh:1443-1447.
  • Known discrepancy with the manual: apparmor.d(5) gives ACCESS TYPE = ( 'allow' | 'deny' ) (apparmor.d.pod:198) and uses prompt only in block examples (apparmor.d.pod:2691, apparmor.d.pod:2700).

for AppArmor developers for security researchers

Code

Read more

03 Prompt gives way to allow and to deny

WHO KEEPS THE PERMISSION prompt @{HOME}/Documents/** rw, ~/Documents/report.odt the prompt rule alone r: ask w: ask @{HOME}/Documents/** r, with the allow r: allow w: ask deny @{HOME}/Documents/private/** rw, ~/Documents/private/tax.ods under private/ r: deny w: deny refused, and not logged ranking at equal priority: deny, then allow, then prompt priority=1 prompt @{HOME}/Documents/** rw, lifts the prompt above the allow: r and w both ask
A prompt rule for read and write on the documents marks both permissions as ask. A plain allow for read turns read into allow while write stays ask. A deny rule for the private subdirectory makes both permissions deny there. Ranking at equal priority: deny, then allow, then prompt.

At equal priority a permission goes to deny, else allow, else prompt. A prompt rule with higher priority overrides both.

Prompt is the weakest of the three access types. Take a prompt rule for read and write on your documents. Alone, it marks both permissions as ask. Now add a plain allow for read on the same files. Read is simply allowed, and there's nothing left to ask. Write stays a prompt permission. Add a deny for a subdirectory, and there both are denied, quietly. So prompt fills the gap between what you allow outright and what you forbid. And if you want the question to stand even though a broader allow exists, give the prompt rule a higher priority.

Details and sources

Details

  • The decision is made per permission of one name. At equal priority a permission goes to a deny rule, else to an allow rule, else to a prompt rule. Rule order in the file has no effect.
  • Parser dumps behind the slide (-D dfa-states-initial, format (allow/deny//prompt/audit/quiet); r is 0x10004, w with append 0x2800a, rw 0x3800e):
RulesStateBasis
prompt /d r,(0x 0/0//10004/0/0)tree's parser at 836052d21
prompt /a rw, /a r,(0x 10004/0//2800a/0/0): read allowed, write and append prompttree's parser at 836052d21
prompt /a rw, deny /a w,(0x 0/2800a//10004/0/2800a): write denied and quiet, read prompttree's parser at 836052d21
priority=1 prompt /a rw, /a r,(0x 0/0//3800e/0/0): read and write prompttree's parser at 836052d21
  • The slide's paths (@{HOME}/Documents/**, private/) are the same rule shapes with the example profile's names; the lamps for them are derived from the scoring and the dumps above, not from a dump of those exact rules.
  • A plain deny also marks the permissions quiet, so the refusal is not logged: syn-allow-deny.
  • What "ask" means at run time depends on the kernel; the kernel refuses such a request (next slide).

for AppArmor developers for security researchers

Code

Read more

04 What the kernel does with it

THE KERNEL prompt @{HOME}/Documents/** r, apparmor_parser allow: - prompt: r quiet: - compiled profile profile loaded: checked and stored allow: - prompt: r demo open("/home/user/Documents/report.odt") is r in allow? no the prompt set is not consulted EACCES apparmor="DENIED" operation="open" ... name="/home/user/Documents/report.odt" ... requested_mask="r" denied_mask="r" ... no question is asked. In complain mode it is logged as ALLOWED, like any missing permission. read from the kernel source, not observed on a running kernel
A prompt rule goes through apparmor_parser into a compiled profile with read in the prompt set and nothing in allow. The kernel stores it. When demo opens the document the kernel only asks whether read is in allow; it is not, so the open is refused with EACCES and a DENIED record is logged.

The kernel unpacks and validates the prompt field and no decision path reads it. By the kernel source, the access is refused and logged as a normal denial.

Follow the rule into the kernel. The parser compiles the prompt permission into its own set, next to allow, and packs it. The kernel unpacks it, checks that it doesn't overlap allow or deny, and keeps it. Then demo opens the document. The decision code looks at allow, and read isn't there. Nothing consults the prompt set. So, going by the kernel source, the open fails and you get an ordinary denied record. On this kernel a prompt rule behaves like no rule at all. And unlike a deny, it isn't silent: the refusal is logged.

Details and sources

Details

All kernel statements here are for the kernel (commit 97d73c825) and come from reading security/apparmor/. Nothing was run on a kernel.

  • struct aa_perms has a prompt member: perms.h:78.
  • Unpack: the prompt word of each permission entry is read at policy_unpack.c:916.
  • Validation: a profile is rejected if prompt overlaps allow or deny, or if complain overlaps prompt: policy_unpack.c:1524-1527.
  • Accumulation when permission sets are merged: perms.h:118, perms.h:145.
  • Decision: aa_check_perms computes denied = request & (~perms->allow | perms->deny) and does not read prompt: lib.c:425-464. The file path does the same in aa_audit_file: file.c:95-154.
  • Result, by that code: in enforce mode the request fails with EACCES and an apparmor="DENIED" record, as for any permission that is not allowed. The record on the slide is shortened; the fields kept are in the kernel's order.
  • Complain mode: derived from the same code, not run. A prompt bit is a bit missing from allow, so the request is permitted and logged as ALLOWED.
  • The features file advertises prompt among the permission table fields (apparmorfs.c:2631); that describes the table layout, not prompting.

Read more

05 PromptMatchFlag, the third accept word and --prompt-compat for AppArmor developers for security researchers

COMPILER: PROMPT rule_mode_t::PROMPT -> PromptMatchFlag aare_rules.h:87, expr-tree.h:1199 deny p*4+3 exact exec p*4+2 allow p*4+1 prompt p*4+0 per bit, the highest score keeps the bit hfa.cc:1536-1554 perms.prompt |= bits hfa.cc:1649 accept1 allow, accept2 audit|quiet, accept3 prompt map_perms_to_accept hfa.h:132 prompt &= ~(allow | deny) policy_compat.cc sd_serialize_perm parser_interface.c:355 no permission table (permstable32 < 2): third word dropped chfa.cc:129-136 --prompt-compat = permsv2 | flag | ignore flag: a profile with prompt rules gets PACKED_MODE_USER (4) parser_policy.c:161 unpack perm->prompt; reject if prompt & (allow|deny); user mode: prompt |= ~(allow|deny) the kernel: nothing consumes it
The path of a prompt rule through the compiler: rule_mode_t PROMPT becomes a PromptMatchFlag node scoring priority times four plus zero, its bits go to perms.prompt and the third accept word, policy_compat masks them against allow and deny and sd_serialize_perm writes them. --prompt-compat=flag puts the profile in user mode. The kernel unpacks and validates the field and nothing consumes it.

PromptMatchFlag scores priority*4 + 0 (parser/libapparmor_re/hfa.cc:1552-1554); the bits are packed as the prompt field (policy_compat.cc). --prompt-compat=flag sets PACKED_MODE_USER.

A prompt rule becomes a PromptMatchFlag node. In the per-bit scoring it gets priority*4 + 0, below allow and deny. That's the ranking you saw. Its bits collect in the state's prompt word, and map_perms_to_accept emits them as the third accept word. The table builders write the prompt field; the file ones also mask it against allow and deny. Without a permission table, the third word is computed and thrown away. The --prompt-compat option is a separate knob. Its only reader is in parser policy, where flag mode marks a profile that uses prompt rules as user mode. The kernel unpacks and validates the field, and nothing consumes it.

Details and sources

for AppArmor developers for security researchers

Details

  • Node: rule_mode_t::PROMPT selects PromptMatchFlag (aare_rules.h:85-89); the class is expr-tree.h:1199-1205.
  • Score in pri_update_perm: priority << 2, plus 3 for DenyMatchFlag, 2 for an exact match on exec bits, 1 for allow, 0 for prompt: hfa.cc:1536-1554. Bits go to perms.prompt, audit bits to perms.audit: hfa.cc:1649-1650.
  • map_perms_to_accept(accept1, accept2, accept3): allow, PACK_AUDIT_CTL(audit, quiet), prompt: hfa.h:132-138.
  • The table builders fill prompt (policy_compat.cc:166-237: lines 166, 182, 207, 237); the two file builders also mask it with ~(perms.allow | perms.deny) (lines 172, 188). Written by sd_serialize_perm: parser_interface.c:355.
  • Without a permission table (kernel_supports_permstable32_version < 2) the third accept word is computed into a local and dropped, so the rule carries nothing: chfa.cc:129-136.
  • A profile is recorded as using prompt rules through prefix_rule_t::uses_prompt (rule.h:374-377) and block_rules::uses_prompt_rules (block_rules.cc:23-36).
  • --prompt-compat=permsv2|default|ignore|flag: parser_main.c:892-905. --print-prompt-compat prints Prompt compat mode: and the mode set by a --prompt-compat option earlier on the command line; with none it prints Unknown prompt compat mode '0' (run with the tree's parser), because the default is chosen after the options are read (parser_main.c:1787-1790): parser_main.c:907-910, parser_common.c:214-229. Default selection, best supported of permsv2, flag, ignore: parser_common.c:189-212.
  • The only reader of the mode: in flag mode a profile that uses prompt rules gets profile_mode::PROMPT (parser_policy.c:161-162), packed as mode 4, PACKED_MODE_USER (policy_unpack.h:40, policy_unpack.c:1233-1234).
  • ignore does not strip prompt permissions: --prompt-compat=ignore, --prompt-compat=permsv2 and no option give the same binary for prompt /a r,, and flag differs from them in the mode word (run with the tree's parser). --prompt-compat=default selects ignore with the abi/5.0 feature set, because it is evaluated before the features are known. Whether that is intended was not determined. The option is not in apparmor_parser(8).
  • The kernel: unpack policy_unpack.c:916; validation policy_unpack.c:1524-1527; user mode sets perms->prompt |= ~(perms->allow | perms->deny) at lib.c:371-372. No decision path reads the field. Read from source, not run.

Read more

06 What to check before relying on prompt

COMMON MISTAKES prompt { deny /etc/demo/secret.key r, } conflicting mode prefix prompt deny /x r, one access type per rule syntax error, unexpected TOK_DENY, expecting TOK_ID or TOK_MODE or TOK_SET_VAR $ apparmor_parser -r /etc/apparmor.d/demo (no output) no warning that this kernel will not prompt prompt @{HOME}/Documents/** r, @{HOME}/** r, the broader allow already grants r: nothing is left to ask expecting a question and getting "Permission denied"? the kernel does not act on prompt rules
Four checks. A prompt block around a deny rule is rejected with conflicting mode prefix. prompt deny on one rule is a syntax error. Loading a profile with prompt rules prints nothing, with no warning that the kernel will not prompt. And a broader allow rule for the same permission leaves nothing to ask.

prompt conflicts with allow and deny on the same rule or block ("conflicting mode prefix"). The parser does not warn when the kernel will not act on prompt rules.

There's very little the parser can tell you here. A prompt block around a deny rule is refused, and so are two access types on one rule. Beyond that it compiles prompt rules without comment, even for a kernel that won't ask. So the mistake to avoid is an assumption: the profile loaded, so somebody will be asked. On the kernel nobody is, and the access is denied. The second thing to check is overlap. An allow for the same permission wins, and then the prompt never comes up.

Details and sources

Details

  • prompt { deny /foo r, } is rejected with conflicting mode prefix (run with the tree's parser at 836052d21). The same message is given for an explicit allow inside a prompt block.
  • prompt deny /x r, is rejected with syntax error, unexpected TOK_DENY, expecting TOK_ID or TOK_MODE or TOK_SET_VAR (run with the tree's parser).
  • Full form of a parse error: AppArmor parser error for FILE in profile FILE at line N: MESSAGE.
  • No warning exists for compiling prompt rules for a kernel that will not act on them (by reading the parser source). On the kernel the access is then refused and logged; see the previous slides.
  • Overlap: at equal priority an allow rule for the same permission and name wins, so nothing remains in the prompt set for it. priority=N on the prompt rule changes that: syn-priority.
  • Known discrepancy, confirmed with the tree's parser: prompt capability chown, compiles to the same binary as capability chown,, so prompt capability X, is stored as an allowed capability. Do not use prompt on capability rules.

for AppArmor developers for security researchers

Code

for security researchers

Attack surface

  • prompt capability X, and prompt { capability X, } fail open: they compile to the same binary as capability X,, so the capability is granted on any kernel, with no message (run with the parser built from the AppArmor tree at 836052d21, nothing loaded into a kernel; block_rules.cc:143-152).
  • The parser prints no warning when a profile with prompt rules is compiled for a kernel that does not prompt. On the kernel a prompt permission is a permission that is not allowed: refused in enforce mode, permitted and logged as ALLOWED in complain mode (file.c:246-247; read from the kernel source, not observed on a running kernel).
  • Where a kernel does act on prompt permissions (mainline Linux does not), the decision moves to an agent in user space, which then belongs to the attack surface. See upstream-and-ubuntu.
  • --prompt-compat=flag marks a profile that uses prompt rules with the user (prompt) profile mode instead; ignore and permsv2 give the same binary as no option (same run).

Read more

07 Where to go from here

ROADS prompt compiled and packed not acted on by the kernel syn-allow-deny the two that outrank it syn-priority let a prompt rule win syn-audit audit prompt syn-qualifier-blocks prompt { ... } re-perms the prompt mask in the table k-unpack where the kernel reads it upstream-and-ubuntu which kernels act on prompt rules syn-flags-modes · syntax-map
prompt in the centre with roads to syn-allow-deny and syn-priority, syn-audit and syn-qualifier-blocks, re-perms and k-unpack, and a row naming syn-flags-modes, syntax-map and upstream-and-ubuntu.

Next: syn-priority, syn-allow-deny, re-perms, k-unpack. Kernels that act on prompt rules: upstream-and-ubuntu.

So prompt is real syntax with a real place in the compiled policy, and a feature that depends on your kernel. If you came here from allow and deny, priority is the natural next stop: it's how a prompt rule can outrank an allow. Audit and qualifier blocks combine with prompt the way they do with the other two. To watch the prompt field travel into the kernel, follow the permissions deck and then the unpack deck. And for which kernels do ask, the upstream and Ubuntu deck is the place.

Details and sources

Details

  • prompt is the third access type. The parser at AppArmor 836052d21 compiles and packs it; the kernel unpacks it and does not act on it (read from source, not run).
  • Which kernels deliver prompt requests to user space is outside both trees read for this deck.

Read more

Read more

Basis of the statements on this page: "tree" means the parser built from the AppArmor commit above was run on the fragment (-Q -K --skip-kernel-load --warn=all), with nothing loaded into a kernel; "code" means the parser or kernel source was read, not run. Nothing here was observed on a running kernel. Kernel statements are for mainline Linux 7.4. What kernels with additional patches do with prompt rules: upstream-and-ubuntu.

Grammar

RULE LINE:  [priority=N] [audit] prompt [owner|other] RULE ,
BLOCK:      [audit] prompt [owner|other] { RULES }
  • priority=N is not allowed in front of a block: priority is not allowed on rule blocks (tree).
  • prompt takes the access type seat; a rule has at most one of allow, deny, prompt (tree).
  • The parser accepts it on file rules and on other rule classes: profile t { prompt /foo r, audit prompt signal, prompt capability chown, } is accepted (tree). For capability rules see "Known discrepancies and gaps".
  • No file in parser/tst/simple_tests/ uses a prompt rule. parser/tst/equality.sh:1445-1447 checks that /t { prompt { /foo r, audit /bar w, owner /baz rw, } } equals /t { prompt /foo r, audit prompt /bar w, prompt owner /baz rw, }.

Ranking

Per permission of one name, at equal priority: deny, then allow, then prompt. Scoring and priority=N: syn-priority.

RulesResultBasis
prompt /d r,read is prompttree
prompt /a rw, and /a r,read allowed; write and append prompttree
priority=1 prompt /a rw, and /a r,read, write and append prompt; nothing allowedtree
prompt /a rw, and deny /a w,write and append denied and quiet; read prompttree

What the kernel receives

  • Each entry of the permission table has a prompt field next to allow, deny, audit and quiet. A permission is in at most one of allow and prompt, because each bit goes to one kind of rule; the file table builders also mask the field with allow and deny (code).
  • This needs a permission table. For a kernel without one the prompt bits are computed and dropped: the rule then grants nothing and carries nothing (code).
  • Mainline Linux 7.4 rejects a profile in which prompt overlaps allow or deny, or complain overlaps prompt (code; linux:security/apparmor/policy_unpack.c:1524-1527).

What mainline Linux 7.4 does

Read from linux 97d73c825 (7.4-rc2), security/apparmor/; not run.

StepWhat happensWhere
unpackthe prompt word of each entry is readlinux:security/apparmor/policy_unpack.c:916
validateoverlap with allow, deny or complain rejects the profilelinux:security/apparmor/policy_unpack.c:1524-1527
accumulatemerged into combined permission sets, minus allow and denylinux:security/apparmor/include/perms.h:118, 145
user modea profile in user mode gets prompt for everything not allowed or deniedlinux:security/apparmor/lib.c:371-372
decideaa_check_perms and aa_audit_file read allow, deny, audit, quiet and hide; not promptlinux:security/apparmor/lib.c:425-464, file.c:95-154

Result: a prompt permission is a permission that is not in allow. In enforce mode the request is refused with EACCES and logged as DENIED. In complain mode it is permitted and logged as ALLOWED (derived from the same code). No question is put to user space.

Parser options

OptionEffect
--prompt-compat=permsv2select the permsv2 mode
--prompt-compat=flaga profile that uses prompt rules is given the prompt profile mode, packed as kernel mode 4 (user)
--prompt-compat=ignoreselect the ignore mode; this does not remove prompt permissions from the output and produces the same binary as permsv2 (tree)
--prompt-compat=defaultmeant as the best supported of permsv2 (needs permission table version 2 or later), flag (needs a permission table), ignore. Evaluated while options are read, before the kernel features are known: with the abi/5.0 feature set it selects ignore (tree). With no option the parser picks the best supported mode later
--print-prompt-compatprints Prompt compat mode: and the mode set so far on stderr, then exits; without an earlier --prompt-compat it prints Unknown prompt compat mode '0' (tree)

The print rows and the ignore, permsv2 and flag comparison were run with the tree's parser; the rest is from the code (parser/parser_main.c:892-911, 1769-1790, parser/parser_common.c:189-229). Neither option is in apparmor_parser(8). The prompt profile mode itself: syn-flags-modes.

Errors and warnings

A parse error is printed as AppArmor parser error for FILE in profile FILE at line N: MESSAGE (tree).

MessageCause
conflicting mode prefixa rule's explicit access type against its block's, as in prompt { deny /foo r, } (tree)
syntax error, unexpected TOK_DENY, expecting TOK_ID or TOK_MODE or TOK_SET_VARprompt deny /x r,: one access type per rule (tree)
%s: Invalid --prompt-compat option '%s'an unknown value for --prompt-compat; the parser exits with status 1 (code)

There is no warning for compiling prompt rules for a kernel that will not act on them (code).

Known discrepancies and gaps

  • Known discrepancy: prompt capability X, is stored as an allowed capability; only deny is distinguished for capabilities (code, parser/block_rules.cc:143-152; tree: prompt capability chown, compiles to the same binary as capability chown,). Do not use prompt on capability rules.
  • Known discrepancy with the manual: apparmor.d(5) omits prompt from ACCESS TYPE (parser/apparmor.d.pod:198) and uses it only in block examples (2691, 2700); --prompt-compat is not documented.
  • Not determined: whether prompt has any representation in the legacy network table.
  • Not determined: whether --prompt-compat=ignore is meant to strip prompt permissions; no code does.
  • Outside both trees: how a kernel with user-space prompting uses the prompt mask and the audit bits of prompt rules. See upstream-and-ubuntu.

for AppArmor developers for security researchers

Code map

StepWhere
grammar: TOK_PROMPT in opt_rule_modeparser/parser_yacc.y:703; keyword parser/parser_misc.c:102
prefix_rule_t::uses_promptparser/rule.h:374-377
conflict check, "conflicting mode prefix"parser/rule.h:409-416
block_rules::uses_prompt_rulesparser/block_rules.cc:23-36, 617-618
PromptMatchFlagparser/libapparmor_re/expr-tree.h:1199-1205; chosen in aare_rules.h:87-88
pri_update_perm: score priority*4 + 0 for prompt; perms.prompt, perms.auditparser/libapparmor_re/hfa.cc:1536-1554, 1649-1650
map_perms_to_accept: third accept wordparser/libapparmor_re/hfa.h:132-138
the table builders fill perms.promptparser/libapparmor_re/policy_compat.cc:166, 182, 207, 237
the two file builders mask it: perms.prompt &= ~(perms.allow or perms.deny)parser/libapparmor_re/policy_compat.cc:172, 188
third word dropped without a permission tableparser/libapparmor_re/chfa.cc:129-136, 160-163
sd_serialize_permparser/parser_interface.c:355
prompt_compat_mode, optionsparser/parser_main.c:203-204, 892-910, 1787-1790; parser/parser_common.c:189-229
profile_mode::PROMPT in flag modeparser/parser_policy.c:161-162
PACKED_MODE_USER (Linux 7.4)linux:security/apparmor/include/policy_unpack.h:40, policy_unpack.c:1233-1234
unpack_perm, validation (Linux 7.4)linux:security/apparmor/policy_unpack.c:916, 1524-1527
aa_compute_profile_perms user-mode line (Linux 7.4)linux:security/apparmor/lib.c:371-372

Dump format (-D dfa-states-initial): (allow/deny//prompt/audit/quiet) in hex; the doubled / is a known defect of the dump. Bits per half: x 0x1, w 0x2, r 0x4, a 0x8; the other half is shifted left by 14.

RulesStateBasis
prompt /d r,(0x 0/0//10004/0/0)tree
prompt /a rw, /a r,(0x 10004/0//2800a/0/0)tree
priority=1 prompt /a rw, /a r,(0x 0/0//3800e/0/0)tree
prompt /a rw, deny /a w,(0x 0/2800a//10004/0/2800a)tree

Roads from here

START HERE

PROFILE HEAD

QUALIFIERS

IN THE KERNEL

THE DFA ENGINE · libapparmor_re