16cd6a6acSopenharmony_ciAccess Vector Rules
26cd6a6acSopenharmony_ci===================
36cd6a6acSopenharmony_ci
46cd6a6acSopenharmony_ciallow
56cd6a6acSopenharmony_ci-----
66cd6a6acSopenharmony_ci
76cd6a6acSopenharmony_ciSpecifies the access allowed between a source and target type. Note that access may be refined by constraint rules based on the source, target and class ([`validatetrans`](cil_constraint_statements.md#validatetrans) or [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans)) or source, target class and permissions ([`constrain`](cil_constraint_statements.md#constrain) or [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain) statements).
86cd6a6acSopenharmony_ci
96cd6a6acSopenharmony_ci**Rule definition:**
106cd6a6acSopenharmony_ci
116cd6a6acSopenharmony_ci```secil
126cd6a6acSopenharmony_ci    (allow source_id target_id|self classpermissionset_id ...)
136cd6a6acSopenharmony_ci```
146cd6a6acSopenharmony_ci
156cd6a6acSopenharmony_ci**Where:**
166cd6a6acSopenharmony_ci
176cd6a6acSopenharmony_ci<table>
186cd6a6acSopenharmony_ci<colgroup>
196cd6a6acSopenharmony_ci<col width="27%" />
206cd6a6acSopenharmony_ci<col width="72%" />
216cd6a6acSopenharmony_ci</colgroup>
226cd6a6acSopenharmony_ci<tbody>
236cd6a6acSopenharmony_ci<tr class="odd">
246cd6a6acSopenharmony_ci<td align="left"><p><code>allow</code></p></td>
256cd6a6acSopenharmony_ci<td align="left"><p>The <code>allow</code> keyword.</p></td>
266cd6a6acSopenharmony_ci</tr>
276cd6a6acSopenharmony_ci<tr class="even">
286cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
296cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
306cd6a6acSopenharmony_ci</tr>
316cd6a6acSopenharmony_ci<tr class="odd">
326cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
336cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
346cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
356cd6a6acSopenharmony_ci</tr>
366cd6a6acSopenharmony_ci<tr class="even">
376cd6a6acSopenharmony_ci<td align="left"><p><code>classpermissionset_id</code></p></td>
386cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>classpermissionset</code> or a single set of <code>classmap</code>/<code>classmapping</code> identifiers.</p></td>
396cd6a6acSopenharmony_ci</tr>
406cd6a6acSopenharmony_ci</tbody>
416cd6a6acSopenharmony_ci</table>
426cd6a6acSopenharmony_ci
436cd6a6acSopenharmony_ci**Examples:**
446cd6a6acSopenharmony_ci
456cd6a6acSopenharmony_ciThese examples show a selection of possible permutations of [`allow`](cil_access_vector_rules.md#allow) rules:
466cd6a6acSopenharmony_ci
476cd6a6acSopenharmony_ci```secil
486cd6a6acSopenharmony_ci    (class binder (impersonate call set_context_mgr transfer receive))
496cd6a6acSopenharmony_ci    (class property_service (set))
506cd6a6acSopenharmony_ci    (class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
516cd6a6acSopenharmony_ci
526cd6a6acSopenharmony_ci    (classpermission cps_zygote)
536cd6a6acSopenharmony_ci    (classpermissionset cps_zygote (zygote (not (specifyids))))
546cd6a6acSopenharmony_ci
556cd6a6acSopenharmony_ci    (classmap android_classes (set_1 set_2 set_3))
566cd6a6acSopenharmony_ci
576cd6a6acSopenharmony_ci    (classmapping android_classes set_1 (binder (all)))
586cd6a6acSopenharmony_ci    (classmapping android_classes set_1 (property_service (set)))
596cd6a6acSopenharmony_ci    (classmapping android_classes set_1 (zygote (not (specifycapabilities))))
606cd6a6acSopenharmony_ci
616cd6a6acSopenharmony_ci    (classmapping android_classes set_2 (binder (impersonate call set_context_mgr transfer)))
626cd6a6acSopenharmony_ci    (classmapping android_classes set_2 (zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith)))
636cd6a6acSopenharmony_ci
646cd6a6acSopenharmony_ci    (classmapping android_classes set_3 cps_zygote)
656cd6a6acSopenharmony_ci    (classmapping android_classes set_3 (binder (impersonate call set_context_mgr)))
666cd6a6acSopenharmony_ci
676cd6a6acSopenharmony_ci    (block av_rules
686cd6a6acSopenharmony_ci        (type type_1)
696cd6a6acSopenharmony_ci        (type type_2)
706cd6a6acSopenharmony_ci        (type type_3)
716cd6a6acSopenharmony_ci        (type type_4)
726cd6a6acSopenharmony_ci        (type type_5)
736cd6a6acSopenharmony_ci
746cd6a6acSopenharmony_ci        (typeattribute all_types)
756cd6a6acSopenharmony_ci        (typeattributeset all_types (all))
766cd6a6acSopenharmony_ci
776cd6a6acSopenharmony_ci    ; These examples have named and anonymous classpermissionset's and
786cd6a6acSopenharmony_ci    ; classmap/classmapping statements
796cd6a6acSopenharmony_ci        (allow type_1 self (property_service (set)))          ; anonymous
806cd6a6acSopenharmony_ci        (allow type_2 self (zygote (specifyids)))             ; anonymous
816cd6a6acSopenharmony_ci        (allow type_3 self cps_zygote)                        ; named
826cd6a6acSopenharmony_ci        (allow type_4 self (android_classes (set_3)))         ; classmap/classmapping
836cd6a6acSopenharmony_ci        (allow all_types all_types (android_classes (set_2))) ; classmap/classmapping
846cd6a6acSopenharmony_ci
856cd6a6acSopenharmony_ci    ;; This rule will cause the build to fail unless --disable-neverallow
866cd6a6acSopenharmony_ci    ;    (neverallow type_5 all_types (property_service (set)))
876cd6a6acSopenharmony_ci        (allow type_5 type_5 (property_service (set)))
886cd6a6acSopenharmony_ci        (allow type_1 all_types (property_service (set)))
896cd6a6acSopenharmony_ci    )
906cd6a6acSopenharmony_ci```
916cd6a6acSopenharmony_ci
926cd6a6acSopenharmony_ciauditallow
936cd6a6acSopenharmony_ci----------
946cd6a6acSopenharmony_ci
956cd6a6acSopenharmony_ciAudit the access rights defined if there is a valid allow rule. Note: It does NOT allow access, it only audits the event.
966cd6a6acSopenharmony_ci
976cd6a6acSopenharmony_ci**Rule definition:**
986cd6a6acSopenharmony_ci
996cd6a6acSopenharmony_ci```secil
1006cd6a6acSopenharmony_ci    (auditallow source_id target_id|self classpermissionset_id ...)
1016cd6a6acSopenharmony_ci```
1026cd6a6acSopenharmony_ci
1036cd6a6acSopenharmony_ci**Where:**
1046cd6a6acSopenharmony_ci
1056cd6a6acSopenharmony_ci<table>
1066cd6a6acSopenharmony_ci<colgroup>
1076cd6a6acSopenharmony_ci<col width="29%" />
1086cd6a6acSopenharmony_ci<col width="70%" />
1096cd6a6acSopenharmony_ci</colgroup>
1106cd6a6acSopenharmony_ci<tbody>
1116cd6a6acSopenharmony_ci<tr class="odd">
1126cd6a6acSopenharmony_ci<td align="left"><p><code>auditallow</code></p></td>
1136cd6a6acSopenharmony_ci<td align="left"><p>The <code>auditallow</code> keyword.</p></td>
1146cd6a6acSopenharmony_ci</tr>
1156cd6a6acSopenharmony_ci<tr class="even">
1166cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
1176cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
1186cd6a6acSopenharmony_ci</tr>
1196cd6a6acSopenharmony_ci<tr class="odd">
1206cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
1216cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
1226cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
1236cd6a6acSopenharmony_ci</tr>
1246cd6a6acSopenharmony_ci<tr class="even">
1256cd6a6acSopenharmony_ci<td align="left"><p><code>classpermissionset_id</code></p></td>
1266cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>classpermissionset</code> or a single set of <code>classmap</code>/<code>classmapping</code> identifiers.</p></td>
1276cd6a6acSopenharmony_ci</tr>
1286cd6a6acSopenharmony_ci</tbody>
1296cd6a6acSopenharmony_ci</table>
1306cd6a6acSopenharmony_ci
1316cd6a6acSopenharmony_ci**Example:**
1326cd6a6acSopenharmony_ci
1336cd6a6acSopenharmony_ciThis example will log an audit event whenever the corresponding [`allow`](cil_access_vector_rules.md#allow) rule grants access to the specified permissions:
1346cd6a6acSopenharmony_ci
1356cd6a6acSopenharmony_ci```secil
1366cd6a6acSopenharmony_ci    (allow release_app.process secmark_demo.browser_packet (packet (send recv append bind)))
1376cd6a6acSopenharmony_ci
1386cd6a6acSopenharmony_ci    (auditallow release_app.process secmark_demo.browser_packet (packet (send recv)))
1396cd6a6acSopenharmony_ci```
1406cd6a6acSopenharmony_ci
1416cd6a6acSopenharmony_cidontaudit
1426cd6a6acSopenharmony_ci---------
1436cd6a6acSopenharmony_ci
1446cd6a6acSopenharmony_ciDo not audit the access rights defined when access denied. This stops excessive log entries for known events.
1456cd6a6acSopenharmony_ci
1466cd6a6acSopenharmony_ciNote that these rules can be omitted by the CIL compiler command line parameter `-D` or `--disable-dontaudit` flags.
1476cd6a6acSopenharmony_ci
1486cd6a6acSopenharmony_ci**Rule definition:**
1496cd6a6acSopenharmony_ci
1506cd6a6acSopenharmony_ci```secil
1516cd6a6acSopenharmony_ci    (dontaudit source_id target_id|self classpermissionset_id ...)
1526cd6a6acSopenharmony_ci```
1536cd6a6acSopenharmony_ci
1546cd6a6acSopenharmony_ci**Where:**
1556cd6a6acSopenharmony_ci
1566cd6a6acSopenharmony_ci<table>
1576cd6a6acSopenharmony_ci<colgroup>
1586cd6a6acSopenharmony_ci<col width="27%" />
1596cd6a6acSopenharmony_ci<col width="72%" />
1606cd6a6acSopenharmony_ci</colgroup>
1616cd6a6acSopenharmony_ci<tbody>
1626cd6a6acSopenharmony_ci<tr class="odd">
1636cd6a6acSopenharmony_ci<td align="left"><p><code>dontaudit</code></p></td>
1646cd6a6acSopenharmony_ci<td align="left"><p>The <code>dontaudit</code> keyword.</p></td>
1656cd6a6acSopenharmony_ci</tr>
1666cd6a6acSopenharmony_ci<tr class="even">
1676cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
1686cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
1696cd6a6acSopenharmony_ci</tr>
1706cd6a6acSopenharmony_ci<tr class="odd">
1716cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
1726cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
1736cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
1746cd6a6acSopenharmony_ci</tr>
1756cd6a6acSopenharmony_ci<tr class="even">
1766cd6a6acSopenharmony_ci<td align="left"><p><code>classpermissionset_id</code></p></td>
1776cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>classpermissionset</code> or a single set of <code>classmap</code>/<code>classmapping</code> identifiers.</p></td>
1786cd6a6acSopenharmony_ci</tr>
1796cd6a6acSopenharmony_ci</tbody>
1806cd6a6acSopenharmony_ci</table>
1816cd6a6acSopenharmony_ci
1826cd6a6acSopenharmony_ci**Example:**
1836cd6a6acSopenharmony_ci
1846cd6a6acSopenharmony_ciThis example will not audit the denied access:
1856cd6a6acSopenharmony_ci
1866cd6a6acSopenharmony_ci```secil
1876cd6a6acSopenharmony_ci    (dontaudit zygote.process self (capability (fsetid)))
1886cd6a6acSopenharmony_ci```
1896cd6a6acSopenharmony_ci
1906cd6a6acSopenharmony_cineverallow
1916cd6a6acSopenharmony_ci----------
1926cd6a6acSopenharmony_ci
1936cd6a6acSopenharmony_ciNever allow access rights defined. This is a compiler enforced action that will stop compilation until the offending rules are modified.
1946cd6a6acSopenharmony_ci
1956cd6a6acSopenharmony_ciNote that these rules can be over-ridden by the CIL compiler command line parameter `-N` or `--disable-neverallow` flags.
1966cd6a6acSopenharmony_ci
1976cd6a6acSopenharmony_ci**Rule definition:**
1986cd6a6acSopenharmony_ci
1996cd6a6acSopenharmony_ci```secil
2006cd6a6acSopenharmony_ci    (neverallow source_id target_id|self classpermissionset_id ...)
2016cd6a6acSopenharmony_ci```
2026cd6a6acSopenharmony_ci
2036cd6a6acSopenharmony_ci**Where:**
2046cd6a6acSopenharmony_ci
2056cd6a6acSopenharmony_ci<table>
2066cd6a6acSopenharmony_ci<colgroup>
2076cd6a6acSopenharmony_ci<col width="27%" />
2086cd6a6acSopenharmony_ci<col width="72%" />
2096cd6a6acSopenharmony_ci</colgroup>
2106cd6a6acSopenharmony_ci<tbody>
2116cd6a6acSopenharmony_ci<tr class="odd">
2126cd6a6acSopenharmony_ci<td align="left"><p><code>neverallow</code></p></td>
2136cd6a6acSopenharmony_ci<td align="left"><p>The <code>neverallow</code> keyword.</p></td>
2146cd6a6acSopenharmony_ci</tr>
2156cd6a6acSopenharmony_ci<tr class="even">
2166cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
2176cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
2186cd6a6acSopenharmony_ci</tr>
2196cd6a6acSopenharmony_ci<tr class="odd">
2206cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
2216cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
2226cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
2236cd6a6acSopenharmony_ci</tr>
2246cd6a6acSopenharmony_ci<tr class="even">
2256cd6a6acSopenharmony_ci<td align="left"><p><code>classpermissionset_id</code></p></td>
2266cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>classpermissionset</code> or a single set of <code>classmap</code>/<code>classmapping</code> identifiers.</p></td>
2276cd6a6acSopenharmony_ci</tr>
2286cd6a6acSopenharmony_ci</tbody>
2296cd6a6acSopenharmony_ci</table>
2306cd6a6acSopenharmony_ci
2316cd6a6acSopenharmony_ci**Example:**
2326cd6a6acSopenharmony_ci
2336cd6a6acSopenharmony_ciThis example will not compile as `type_3` is not allowed to be a source type for the [`allow`](cil_access_vector_rules.md#allow) rule:
2346cd6a6acSopenharmony_ci
2356cd6a6acSopenharmony_ci```secil
2366cd6a6acSopenharmony_ci    (class property_service (set))
2376cd6a6acSopenharmony_ci
2386cd6a6acSopenharmony_ci    (block av_rules
2396cd6a6acSopenharmony_ci        (type type_1)
2406cd6a6acSopenharmony_ci        (type type_2)
2416cd6a6acSopenharmony_ci        (type type_3)
2426cd6a6acSopenharmony_ci        (typeattribute all_types)
2436cd6a6acSopenharmony_ci        (typeattributeset all_types ((all)))
2446cd6a6acSopenharmony_ci
2456cd6a6acSopenharmony_ci        (neverallow type_3 all_types (property_service (set)))
2466cd6a6acSopenharmony_ci        ; This rule will fail compilation:
2476cd6a6acSopenharmony_ci        (allow type_3 self (property_service (set)))
2486cd6a6acSopenharmony_ci    )
2496cd6a6acSopenharmony_ci```
2506cd6a6acSopenharmony_ci
2516cd6a6acSopenharmony_ciallowx
2526cd6a6acSopenharmony_ci------
2536cd6a6acSopenharmony_ci
2546cd6a6acSopenharmony_ciSpecifies the access allowed between a source and target type using extended permissions. Unlike the [`allow`](cil_access_vector_rules.md#allow) statement, the statements [`validatetrans`](cil_constraint_statements.md#validatetrans), [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans), [`constrain`](cil_constraint_statements.md#constrain), and [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain) do not limit accesses granted by [`allowx`](cil_access_vector_rules.md#allowx).
2556cd6a6acSopenharmony_ci
2566cd6a6acSopenharmony_ciNote that for this to work there must *also* be valid equivalent [`allow`](cil_access_vector_rules.md#allow) rules present.
2576cd6a6acSopenharmony_ci
2586cd6a6acSopenharmony_ci**Rule definition:**
2596cd6a6acSopenharmony_ci
2606cd6a6acSopenharmony_ci```secil
2616cd6a6acSopenharmony_ci    (allowx source_id target_id|self permissionx_id)
2626cd6a6acSopenharmony_ci```
2636cd6a6acSopenharmony_ci
2646cd6a6acSopenharmony_ci**Where:**
2656cd6a6acSopenharmony_ci
2666cd6a6acSopenharmony_ci<table>
2676cd6a6acSopenharmony_ci<colgroup>
2686cd6a6acSopenharmony_ci<col width="27%" />
2696cd6a6acSopenharmony_ci<col width="72%" />
2706cd6a6acSopenharmony_ci</colgroup>
2716cd6a6acSopenharmony_ci<tbody>
2726cd6a6acSopenharmony_ci<tr class="odd">
2736cd6a6acSopenharmony_ci<td align="left"><p><code>allowx</code></p></td>
2746cd6a6acSopenharmony_ci<td align="left"><p>The <code>allowx</code> keyword.</p></td>
2756cd6a6acSopenharmony_ci</tr>
2766cd6a6acSopenharmony_ci<tr class="even">
2776cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
2786cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code>, or <code>typeattribute</code> identifier.</p></td>
2796cd6a6acSopenharmony_ci</tr>
2806cd6a6acSopenharmony_ci<tr class="odd">
2816cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
2826cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code>, or <code>typeattribute</code> identifier.</p>
2836cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
2846cd6a6acSopenharmony_ci</tr>
2856cd6a6acSopenharmony_ci<tr class="even">
2866cd6a6acSopenharmony_ci<td align="left"><p><code>permissionx_id</code></p></td>
2876cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>permissionx</code>.</p></td>
2886cd6a6acSopenharmony_ci</tr>
2896cd6a6acSopenharmony_ci</tbody>
2906cd6a6acSopenharmony_ci</table>
2916cd6a6acSopenharmony_ci
2926cd6a6acSopenharmony_ci**Examples:**
2936cd6a6acSopenharmony_ci
2946cd6a6acSopenharmony_ciThese examples show a selection of possible permutations of [`allowx`](cil_access_vector_rules.md#allowx) rules:
2956cd6a6acSopenharmony_ci
2966cd6a6acSopenharmony_ci```secil
2976cd6a6acSopenharmony_ci    (allow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
2986cd6a6acSopenharmony_ci    (allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
2996cd6a6acSopenharmony_ci
3006cd6a6acSopenharmony_ci    (permissionx ioctl_nodebug (ioctl udp_socket (not (range 0x4000 0x4010))))
3016cd6a6acSopenharmony_ci    (allow type_3 type_4 (udp_socket (ioctl))) ;; pre-requisite
3026cd6a6acSopenharmony_ci    (allowx type_3 type_4 ioctl_nodebug)
3036cd6a6acSopenharmony_ci```
3046cd6a6acSopenharmony_ci
3056cd6a6acSopenharmony_ci
3066cd6a6acSopenharmony_ciauditallowx
3076cd6a6acSopenharmony_ci-----------
3086cd6a6acSopenharmony_ci
3096cd6a6acSopenharmony_ciAudit the access rights defined if there is a valid [`allowx`](cil_access_vector_rules.md#allowx) rule. It does NOT allow access, it only audits the event.
3106cd6a6acSopenharmony_ci
3116cd6a6acSopenharmony_ciNote that for this to work there must *also* be valid equivalent [`auditallow`](cil_access_vector_rules.md#auditallow) rules present.
3126cd6a6acSopenharmony_ci
3136cd6a6acSopenharmony_ci**Rule definition:**
3146cd6a6acSopenharmony_ci
3156cd6a6acSopenharmony_ci```secil
3166cd6a6acSopenharmony_ci    (auditallowx source_id target_id|self permissionx_id)
3176cd6a6acSopenharmony_ci```
3186cd6a6acSopenharmony_ci
3196cd6a6acSopenharmony_ci**Where:**
3206cd6a6acSopenharmony_ci
3216cd6a6acSopenharmony_ci<table>
3226cd6a6acSopenharmony_ci<colgroup>
3236cd6a6acSopenharmony_ci<col width="27%" />
3246cd6a6acSopenharmony_ci<col width="72%" />
3256cd6a6acSopenharmony_ci</colgroup>
3266cd6a6acSopenharmony_ci<tbody>
3276cd6a6acSopenharmony_ci<tr class="odd">
3286cd6a6acSopenharmony_ci<td align="left"><p><code>auditallowx</code></p></td>
3296cd6a6acSopenharmony_ci<td align="left"><p>The <code>auditallowx</code> keyword.</p></td>
3306cd6a6acSopenharmony_ci</tr>
3316cd6a6acSopenharmony_ci<tr class="even">
3326cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
3336cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
3346cd6a6acSopenharmony_ci</tr>
3356cd6a6acSopenharmony_ci<tr class="odd">
3366cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
3376cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
3386cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
3396cd6a6acSopenharmony_ci</tr>
3406cd6a6acSopenharmony_ci<tr class="even">
3416cd6a6acSopenharmony_ci<td align="left"><p><code>permissionx_id</code></p></td>
3426cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>permissionx</code>.</p></td>
3436cd6a6acSopenharmony_ci</tr>
3446cd6a6acSopenharmony_ci</tbody>
3456cd6a6acSopenharmony_ci</table>
3466cd6a6acSopenharmony_ci
3476cd6a6acSopenharmony_ci**Examples:**
3486cd6a6acSopenharmony_ci
3496cd6a6acSopenharmony_ciThis example will log an audit event whenever the corresponding [`allowx`](cil_access_vector_rules.md#allowx) rule grants access to the specified extended permissions:
3506cd6a6acSopenharmony_ci
3516cd6a6acSopenharmony_ci```secil
3526cd6a6acSopenharmony_ci    (allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
3536cd6a6acSopenharmony_ci
3546cd6a6acSopenharmony_ci    (auditallow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
3556cd6a6acSopenharmony_ci    (auditallowx type_1 type_2 (ioctl tcp_socket (range 0x2005 0x2010)))
3566cd6a6acSopenharmony_ci```
3576cd6a6acSopenharmony_ci
3586cd6a6acSopenharmony_cidontauditx
3596cd6a6acSopenharmony_ci----------
3606cd6a6acSopenharmony_ci
3616cd6a6acSopenharmony_ciDo not audit the access rights defined when access denied. This stops excessive log entries for known events.
3626cd6a6acSopenharmony_ci
3636cd6a6acSopenharmony_ciNote that for this to work there must *also* be at least one [`allowx`](cil_access_vector_rules.md#allowx) rule associated with the target type.
3646cd6a6acSopenharmony_ci
3656cd6a6acSopenharmony_ciNote that these rules can be omitted by the CIL compiler command line parameter `-D` or `--disable-dontaudit` flags.
3666cd6a6acSopenharmony_ci
3676cd6a6acSopenharmony_ci**Rule definition:**
3686cd6a6acSopenharmony_ci
3696cd6a6acSopenharmony_ci```secil
3706cd6a6acSopenharmony_ci    (dontauditx source_id target_id|self permissionx_id)
3716cd6a6acSopenharmony_ci```
3726cd6a6acSopenharmony_ci
3736cd6a6acSopenharmony_ci**Where:**
3746cd6a6acSopenharmony_ci
3756cd6a6acSopenharmony_ci<table>
3766cd6a6acSopenharmony_ci<colgroup>
3776cd6a6acSopenharmony_ci<col width="27%" />
3786cd6a6acSopenharmony_ci<col width="72%" />
3796cd6a6acSopenharmony_ci</colgroup>
3806cd6a6acSopenharmony_ci<tbody>
3816cd6a6acSopenharmony_ci<tr class="odd">
3826cd6a6acSopenharmony_ci<td align="left"><p><code>dontauditx</code></p></td>
3836cd6a6acSopenharmony_ci<td align="left"><p>The <code>dontauditx</code> keyword.</p></td>
3846cd6a6acSopenharmony_ci</tr>
3856cd6a6acSopenharmony_ci<tr class="even">
3866cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
3876cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
3886cd6a6acSopenharmony_ci</tr>
3896cd6a6acSopenharmony_ci<tr class="odd">
3906cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
3916cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
3926cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
3936cd6a6acSopenharmony_ci</tr>
3946cd6a6acSopenharmony_ci<tr class="even">
3956cd6a6acSopenharmony_ci<td align="left"><p><code>permissionx_id</code></p></td>
3966cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>permissionx</code>.</p></td>
3976cd6a6acSopenharmony_ci</tr>
3986cd6a6acSopenharmony_ci</tbody>
3996cd6a6acSopenharmony_ci</table>
4006cd6a6acSopenharmony_ci
4016cd6a6acSopenharmony_ci**Examples:**
4026cd6a6acSopenharmony_ci
4036cd6a6acSopenharmony_ciThis example will not audit the denied access:
4046cd6a6acSopenharmony_ci
4056cd6a6acSopenharmony_ci```secil
4066cd6a6acSopenharmony_ci    (allowx type_1 type_2 (ioctl tcp_socket (0x1))) ;; pre-requisite, just some irrelevant random ioctl
4076cd6a6acSopenharmony_ci    (dontauditx type_1 type_2 (ioctl tcp_socket (range 0x3000 0x30FF)))
4086cd6a6acSopenharmony_ci```
4096cd6a6acSopenharmony_ci
4106cd6a6acSopenharmony_cineverallowx
4116cd6a6acSopenharmony_ci----------
4126cd6a6acSopenharmony_ciNever allow access rights defined for extended permissions. This is a compiler enforced action that will stop compilation until the offending rules are modified.
4136cd6a6acSopenharmony_ci
4146cd6a6acSopenharmony_ciNote that these rules can be over-ridden by the CIL compiler command line parameter `-N` or `--disable-neverallow` flags.
4156cd6a6acSopenharmony_ci
4166cd6a6acSopenharmony_ci**Rule definition:**
4176cd6a6acSopenharmony_ci
4186cd6a6acSopenharmony_ci```secil
4196cd6a6acSopenharmony_ci    (neverallowx source_id target_id|self permissionx_id)
4206cd6a6acSopenharmony_ci```
4216cd6a6acSopenharmony_ci
4226cd6a6acSopenharmony_ci**Where:**
4236cd6a6acSopenharmony_ci
4246cd6a6acSopenharmony_ci<table>
4256cd6a6acSopenharmony_ci<colgroup>
4266cd6a6acSopenharmony_ci<col width="27%" />
4276cd6a6acSopenharmony_ci<col width="72%" />
4286cd6a6acSopenharmony_ci</colgroup>
4296cd6a6acSopenharmony_ci<tbody>
4306cd6a6acSopenharmony_ci<tr class="odd">
4316cd6a6acSopenharmony_ci<td align="left"><p><code>neverallowx</code></p></td>
4326cd6a6acSopenharmony_ci<td align="left"><p>The <code>neverallowx</code> keyword.</p></td>
4336cd6a6acSopenharmony_ci</tr>
4346cd6a6acSopenharmony_ci<tr class="even">
4356cd6a6acSopenharmony_ci<td align="left"><p><code>source_id</code></p></td>
4366cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined source <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
4376cd6a6acSopenharmony_ci</tr>
4386cd6a6acSopenharmony_ci<tr class="odd">
4396cd6a6acSopenharmony_ci<td align="left"><p><code>target_id</code></p></td>
4406cd6a6acSopenharmony_ci<td align="left"><p>A single previously defined target <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p>
4416cd6a6acSopenharmony_ci<p>The <code>self</code> keyword may be used instead to signify that source and target are the same.</p></td>
4426cd6a6acSopenharmony_ci</tr>
4436cd6a6acSopenharmony_ci<tr class="even">
4446cd6a6acSopenharmony_ci<td align="left"><p><code>permissionx_id</code></p></td>
4456cd6a6acSopenharmony_ci<td align="left"><p>A single named or anonymous <code>permissionx</code>.</p></td>
4466cd6a6acSopenharmony_ci</tr>
4476cd6a6acSopenharmony_ci</tbody>
4486cd6a6acSopenharmony_ci</table>
4496cd6a6acSopenharmony_ci
4506cd6a6acSopenharmony_ci**Examples:**
4516cd6a6acSopenharmony_ci
4526cd6a6acSopenharmony_ciThis example will not compile as `type_3` is not allowed to be a source type and ioctl range for the [`allowx`](cil_access_vector_rules.md#allowx) rule:
4536cd6a6acSopenharmony_ci
4546cd6a6acSopenharmony_ci```secil
4556cd6a6acSopenharmony_ci	(class property_service (ioctl))
4566cd6a6acSopenharmony_ci	(block av_rules
4576cd6a6acSopenharmony_ci		(type type_1)
4586cd6a6acSopenharmony_ci		(type type_2)
4596cd6a6acSopenharmony_ci		(type type_3)
4606cd6a6acSopenharmony_ci		(typeattribute all_types)
4616cd6a6acSopenharmony_ci		(typeattributeset all_types ((all)))
4626cd6a6acSopenharmony_ci		(neverallowx type_3 all_types (ioctl property_service (range 0x2000 0x20FF)))
4636cd6a6acSopenharmony_ci		; This rule will fail compilation:
4646cd6a6acSopenharmony_ci		(allowx type_3 self (ioctl property_service (0x20A0)))
4656cd6a6acSopenharmony_ci	)
4666cd6a6acSopenharmony_ci```
467