16cd6a6acSopenharmony_ciCIL Information 26cd6a6acSopenharmony_ci=============== 36cd6a6acSopenharmony_ci 46cd6a6acSopenharmony_ci1. Not all possible alternate statement permutations are shown, however there should be enough variation to work out any other valid formats. There is also an example [`policy.cil`](../test/policy.cil#example-policy) file in the test directory. 56cd6a6acSopenharmony_ci 66cd6a6acSopenharmony_ci2. The MLS components on contexts and user statements must be declared even if the policy does not support MCS/MLS. 76cd6a6acSopenharmony_ci 86cd6a6acSopenharmony_ci3. The CIL compiler will not build a policy unless it also has as a minimum: one [`allow`](cil_access_vector_rules.md#allow) rule, one [`sid`](cil_sid_statements.md#sid), [`sidorder`](cil_sid_statements.md#sidorder) and [`sidcontext`](cil_sid_statements.md#sidcontext) statement. 96cd6a6acSopenharmony_ci 106cd6a6acSopenharmony_ci4. The role `object_r` must be explicitly associated to contexts used for labeling objects. The original **`checkpolicy`**`(8)` and **`checkmodule`**`(8)` compilers did this by default - CIL does not. 116cd6a6acSopenharmony_ci 126cd6a6acSopenharmony_ci5. Be aware that CIL allows [`class`](cil_class_and_permission_statements.md#class) statements to be declared in a namespace, however the policy author needs to note that applications (and the kernel) generally reference a class by its well known class identifier (e.g. `zygote`) however if declared in a namespace (e.g. `(block zygote (class zygote (...)))` or `(block zygote (class class (...)))`) it would be prefixed with that namespace (e.g. `zygote.zygote` or `zygote.class`). Unless the application / kernel code was updated the class would never be resolved, therefore it is recommended that classes are declared in the global namespace. 136cd6a6acSopenharmony_ci 146cd6a6acSopenharmony_ci6. Where possible use [`typeattribute`](cil_type_statements.md#typeattribute)'s when defining source/target [`allow`](cil_access_vector_rules.md#allow) rules instead of multiple [`allow`](cil_access_vector_rules.md#allow) rules with individual [`type`](cil_type_statements.md#type)'s. This will lead to the generation of much smaller kernel policy files. 156cd6a6acSopenharmony_ci 166cd6a6acSopenharmony_ci7. The [](http://github.com/SELinuxProject/cil/wiki) site explains the language however some of the statement definitions are dated. 176cd6a6acSopenharmony_ci 186cd6a6acSopenharmony_ciDeclarations 196cd6a6acSopenharmony_ci------------ 206cd6a6acSopenharmony_ci 216cd6a6acSopenharmony_ciDeclarations may be named or anonymous and have three different forms: 226cd6a6acSopenharmony_ci 236cd6a6acSopenharmony_ci1. Named declarations - These create new objects that introduce a name or identifier, for example: 246cd6a6acSopenharmony_ci 256cd6a6acSopenharmony_ci `(type process)` - creates a [`type`](cil_type_statements.md#type) with an identifier of `process`. 266cd6a6acSopenharmony_ci 276cd6a6acSopenharmony_ci `(typeattribute domain)` - creates a [`typeattribute`](cil_type_statements.md#typeattribute) with an identifier of `domain`. 286cd6a6acSopenharmony_ci 296cd6a6acSopenharmony_ci `(class file (read write))` - creates a [`class`](cil_class_and_permission_statements.md#class) with an identifier of `file` that has `read` and `write` permissions associated to it. 306cd6a6acSopenharmony_ci 316cd6a6acSopenharmony_ci The list of declaration type statement keywords are: 326cd6a6acSopenharmony_ci 336cd6a6acSopenharmony_ci block 346cd6a6acSopenharmony_ci optional 356cd6a6acSopenharmony_ci common 366cd6a6acSopenharmony_ci class 376cd6a6acSopenharmony_ci classmap 386cd6a6acSopenharmony_ci classmapping 396cd6a6acSopenharmony_ci sid 406cd6a6acSopenharmony_ci user 416cd6a6acSopenharmony_ci role 426cd6a6acSopenharmony_ci roleattribute 436cd6a6acSopenharmony_ci type 446cd6a6acSopenharmony_ci classpermission 456cd6a6acSopenharmony_ci classpermissionset 466cd6a6acSopenharmony_ci typeattribute 476cd6a6acSopenharmony_ci typealias 486cd6a6acSopenharmony_ci tunable 496cd6a6acSopenharmony_ci sensitivity 506cd6a6acSopenharmony_ci sensitivityalias 516cd6a6acSopenharmony_ci category 526cd6a6acSopenharmony_ci categoryalias 536cd6a6acSopenharmony_ci categoryset 546cd6a6acSopenharmony_ci level 556cd6a6acSopenharmony_ci levelrange 566cd6a6acSopenharmony_ci context 576cd6a6acSopenharmony_ci ipaddr 586cd6a6acSopenharmony_ci macro 596cd6a6acSopenharmony_ci policycap 606cd6a6acSopenharmony_ci 616cd6a6acSopenharmony_ci2. Explicit anonymous declarations - These are currently restricted to IP addresses where they can be declared directly in statements by enclosing them within parentheses e.g. `(127.0.0.1)` or `(::1)`. See the [Network Labeling Statements](#network_labeling) section for examples. 626cd6a6acSopenharmony_ci 636cd6a6acSopenharmony_ci3. Anonymous declarations - These have been previously declared and the object already exists, therefore they may be referenced by their name or identifier within statements. For example the following declare all the components required to specify a context: 646cd6a6acSopenharmony_ci 656cd6a6acSopenharmony_ci ```secil 666cd6a6acSopenharmony_ci (sensitivity s0) 676cd6a6acSopenharmony_ci (category c0) 686cd6a6acSopenharmony_ci (role object_r) 696cd6a6acSopenharmony_ci 706cd6a6acSopenharmony_ci (block unconfined 716cd6a6acSopenharmony_ci (user user) 726cd6a6acSopenharmony_ci (type object) 736cd6a6acSopenharmony_ci ) 746cd6a6acSopenharmony_ci ``` 756cd6a6acSopenharmony_ci 766cd6a6acSopenharmony_ci now a [`portcon`](cil_network_labeling_statements.md#portcon) statement can be defined that uses these individual components to build a context as follows: 776cd6a6acSopenharmony_ci 786cd6a6acSopenharmony_ci ```secil 796cd6a6acSopenharmony_ci (portcon udp 12345 (unconfined.user object_r unconfined.object ((s0) (s0(c0))))) 806cd6a6acSopenharmony_ci ``` 816cd6a6acSopenharmony_ci 826cd6a6acSopenharmony_ciDefinitions 836cd6a6acSopenharmony_ci----------- 846cd6a6acSopenharmony_ci 856cd6a6acSopenharmony_ciStatements that build on the objects, for example: 866cd6a6acSopenharmony_ci 876cd6a6acSopenharmony_ci- `(typeattributeset domain (process))` - Adds the [`type`](cil_type_statements.md#type) '`process`' to the [`typeattribute`](cil_type_statements.md#typeattribute) '`domain`'. 886cd6a6acSopenharmony_ci 896cd6a6acSopenharmony_ci- `(allow domain process (file (read write))))` - Adds an [`allow`](cil_access_vector_rules.md#allow) rule referencing `domain`, `process` and the `file class`. 906cd6a6acSopenharmony_ci 916cd6a6acSopenharmony_ciDefinitions may be repeated many times throughout the policy. Duplicates will resolve to a single definition during compilation. 926cd6a6acSopenharmony_ci 936cd6a6acSopenharmony_ciSymbol Character Set 946cd6a6acSopenharmony_ci-------------------- 956cd6a6acSopenharmony_ci 966cd6a6acSopenharmony_ciSymbols (any string not enclosed in double quotes) must only contain alphanumeric `[a-z A-Z] [0-9]` characters plus the following special characters: `\.@=/-_$%@+!|&^:` 976cd6a6acSopenharmony_ci 986cd6a6acSopenharmony_ciHowever symbols are checked for any specific character set limitations, for example: 996cd6a6acSopenharmony_ci 1006cd6a6acSopenharmony_ci- Names or identifiers must start with an alpa character `[a-z A-Z]`, the remainder may be alphanumeric `[a-z A-Z] [0-9]` characters plus underscore `[_]` or hyphen `[-]`. 1016cd6a6acSopenharmony_ci 1026cd6a6acSopenharmony_ci- IP addresses must conform to IPv4 or IPv6 format. 1036cd6a6acSopenharmony_ci 1046cd6a6acSopenharmony_ci- Memory, ports, irqs must be numeric `[0-9]`. 1056cd6a6acSopenharmony_ci 1066cd6a6acSopenharmony_ciString Character Set 1076cd6a6acSopenharmony_ci-------------------- 1086cd6a6acSopenharmony_ci 1096cd6a6acSopenharmony_ciStrings are enclosed within double quotes (e.g. `"This is a string"`), and may contain any character except the double quote ("). 1106cd6a6acSopenharmony_ci 1116cd6a6acSopenharmony_ciComments 1126cd6a6acSopenharmony_ci-------- 1136cd6a6acSopenharmony_ci 1146cd6a6acSopenharmony_ciComments start with a semicolon '`;`' and end when a new line is started. 1156cd6a6acSopenharmony_ci 1166cd6a6acSopenharmony_ciNamespaces 1176cd6a6acSopenharmony_ci---------- 1186cd6a6acSopenharmony_ci 1196cd6a6acSopenharmony_ciCIL supports namespaces via containers such as the [`block`](cil_container_statements.md#block) statement. When a block is resolved to form the parent / child relationship a dot '`.`' is used, for example the following [`allow`](cil_access_vector_rules.md#allow) rule: 1206cd6a6acSopenharmony_ci 1216cd6a6acSopenharmony_ci```secil 1226cd6a6acSopenharmony_ci (block example_ns 1236cd6a6acSopenharmony_ci (type process) 1246cd6a6acSopenharmony_ci (type object) 1256cd6a6acSopenharmony_ci (class file (open read write getattr)) 1266cd6a6acSopenharmony_ci 1276cd6a6acSopenharmony_ci (allow process object (file (open read getattr))) 1286cd6a6acSopenharmony_ci ) 1296cd6a6acSopenharmony_ci``` 1306cd6a6acSopenharmony_ci 1316cd6a6acSopenharmony_ciwill resolve to the following kernel policy language statement: 1326cd6a6acSopenharmony_ci 1336cd6a6acSopenharmony_ci``` 1346cd6a6acSopenharmony_ci allow example_ns.process example_ns.object : example_ns.file { open read getattr }; 1356cd6a6acSopenharmony_ci``` 1366cd6a6acSopenharmony_ci 1376cd6a6acSopenharmony_ciGlobal Namespace 1386cd6a6acSopenharmony_ci---------------- 1396cd6a6acSopenharmony_ci 1406cd6a6acSopenharmony_ciCIL has a global namespace that is always present. Any symbol that is declared outside a container is in the global namespace. To reference a symbol in global namespace, the symbol should be prefixed with a dot '`.`' as shown in the following example: 1416cd6a6acSopenharmony_ci 1426cd6a6acSopenharmony_ci```secil 1436cd6a6acSopenharmony_ci ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1446cd6a6acSopenharmony_ci ; This example has three namespace 'tmpfs' types declared: 1456cd6a6acSopenharmony_ci ; 1) Global .tmpfs 1466cd6a6acSopenharmony_ci ; 2) file.tmpfs 1476cd6a6acSopenharmony_ci ; 3) other_ns.tmpfs 1486cd6a6acSopenharmony_ci ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1496cd6a6acSopenharmony_ci 1506cd6a6acSopenharmony_ci ; This type is the global tmpfs: 1516cd6a6acSopenharmony_ci (type tmpfs) 1526cd6a6acSopenharmony_ci 1536cd6a6acSopenharmony_ci (block file 1546cd6a6acSopenharmony_ci ; file namespace tmpfs 1556cd6a6acSopenharmony_ci (type tmpfs) 1566cd6a6acSopenharmony_ci (class file (open read write getattr)) 1576cd6a6acSopenharmony_ci 1586cd6a6acSopenharmony_ci ; This rule will reference the local namespace for src and tgt: 1596cd6a6acSopenharmony_ci (allow tmpfs tmpfs (file (open))) 1606cd6a6acSopenharmony_ci ; Resulting policy rule: 1616cd6a6acSopenharmony_ci ; allow file.tmpfs file.tmpfs : file.file open; 1626cd6a6acSopenharmony_ci 1636cd6a6acSopenharmony_ci ; This rule will reference the local namespace for src and global for tgt: 1646cd6a6acSopenharmony_ci (allow tmpfs .tmpfs (file (read))) 1656cd6a6acSopenharmony_ci ; Resulting policy rule: 1666cd6a6acSopenharmony_ci ; allow file.tmpfs tmpfs : file.file read; 1676cd6a6acSopenharmony_ci 1686cd6a6acSopenharmony_ci ; This rule will reference the global namespace for src and tgt: 1696cd6a6acSopenharmony_ci (allow .tmpfs .tmpfs (file (write))) 1706cd6a6acSopenharmony_ci ; Resulting policy rule: 1716cd6a6acSopenharmony_ci ; allow tmpfs tmpfs : file.file write; 1726cd6a6acSopenharmony_ci 1736cd6a6acSopenharmony_ci ; This rule will reference the other_ns namespace for src and 1746cd6a6acSopenharmony_ci ; local namespace for tgt: 1756cd6a6acSopenharmony_ci (allow other_ns.tmpfs tmpfs (file (getattr))) 1766cd6a6acSopenharmony_ci ; Resulting policy rule: 1776cd6a6acSopenharmony_ci ; allow other_ns.tmpfs file.tmpfs : file.file getattr; 1786cd6a6acSopenharmony_ci ) 1796cd6a6acSopenharmony_ci 1806cd6a6acSopenharmony_ci (block other_ns 1816cd6a6acSopenharmony_ci (type tmpfs) 1826cd6a6acSopenharmony_ci ) 1836cd6a6acSopenharmony_ci``` 1846cd6a6acSopenharmony_ci 1856cd6a6acSopenharmony_ciShould the symbol not be prefixed with a dot, the current namespace would be searched first and then the global namespace (provided there is not a symbol of that name in the current namespace). 1866cd6a6acSopenharmony_ci 1876cd6a6acSopenharmony_ciExpressions 1886cd6a6acSopenharmony_ci----------- 1896cd6a6acSopenharmony_ci 1906cd6a6acSopenharmony_ciExpressions may occur in the following CIL statements: [`booleanif`](cil_conditional_statements.md#booleanif), [`tunableif`](cil_conditional_statements.md#tunableif), [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset), [`typeattributeset`](cil_type_statements.md#typeattributeset), [`roleattributeset`](cil_role_statements.md#roleattributeset), [`categoryset`](cil_mls_labeling_statements.md#categoryset), [`constrain`](cil_constraint_statements.md#constrain), [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain), [`validatetrans`](cil_constraint_statements.md#validatetrans), [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) 1916cd6a6acSopenharmony_ci 1926cd6a6acSopenharmony_ciCIL expressions use the [prefix](http://www.cs.man.ac.uk/~pjj/cs212/fix.html) or Polish notation and may be nested (note that the kernel policy language uses infix notation). The syntax is as follows, where the parenthesis are part of the syntax: 1936cd6a6acSopenharmony_ci 1946cd6a6acSopenharmony_ci``` 1956cd6a6acSopenharmony_ci expr_set = (name ... | expr ...) 1966cd6a6acSopenharmony_ci expr = (expr_key expr_set ...) 1976cd6a6acSopenharmony_ci expr_key = and | or | xor | not | all | eq | neq | dom | domby | incomp | range 1986cd6a6acSopenharmony_ci``` 1996cd6a6acSopenharmony_ci 2006cd6a6acSopenharmony_ciThe number of `expr_set`'s in an `expr` is dependent on the statement type (there are four different classes as defined below) that also influence the valid `expr_key` entries (e.g. `dom`, `domby`, `incomp` are only allowed in constraint statements). 2016cd6a6acSopenharmony_ci 2026cd6a6acSopenharmony_ci| expr_key | classpermissionset roleattributeset typeattributeset | categoryset | booleanif tunableif | constrain mlsconstrain validatetrans mlsvalidatetrans | 2036cd6a6acSopenharmony_ci|:----------:|:----------:|:----------:|:----------:|:----------:| 2046cd6a6acSopenharmony_ci| **`dom`** | | | | **X** | 2056cd6a6acSopenharmony_ci| **`domby`** | | | | **X** | 2066cd6a6acSopenharmony_ci| **`incomp`** | | | | **X** | 2076cd6a6acSopenharmony_ci| **`eq`** | | | **X** | **X** | 2086cd6a6acSopenharmony_ci| **`ne`** | | | **X** | **X** | 2096cd6a6acSopenharmony_ci| **`and`** | **X** | **X** | **X** | **X** | 2106cd6a6acSopenharmony_ci| **`or`** | **X** | **X** | **X** | **X** | 2116cd6a6acSopenharmony_ci| **`not`** | **X** | **X** | **X** | **X** | 2126cd6a6acSopenharmony_ci| **`xor`** | **X** | **X** | **X** | | 2136cd6a6acSopenharmony_ci| **`all`** | **X** | **X** | | | 2146cd6a6acSopenharmony_ci| **`range`** | | **X** | | | 2156cd6a6acSopenharmony_ci 2166cd6a6acSopenharmony_ci1. The [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset), [`roleattributeset`](cil_role_statements.md#roleattributeset) and [`typeattributeset`](cil_type_statements.md#typeattributeset) statements allow `expr_set` to mix names and `expr`s with `expr_key` values of: `and`, `or`, `xor`, `not`, `all` as shown in the examples: 2176cd6a6acSopenharmony_ci 2186cd6a6acSopenharmony_ci This example includes all `fs_type type` entries except `file.usermodehelper` and `file.proc_security` in the associated [`typeattribute`](cil_type_statements.md#typeattribute) identifier `all_fs_type_except_usermodehelper_and_proc_security`: 2196cd6a6acSopenharmony_ci 2206cd6a6acSopenharmony_ci ```secil 2216cd6a6acSopenharmony_ci (typeattribute all_fs_type_except_usermodehelper_and_proc_security) 2226cd6a6acSopenharmony_ci 2236cd6a6acSopenharmony_ci (typeattributeset all_fs_type_except_usermodehelper_and_proc_security 2246cd6a6acSopenharmony_ci (and 2256cd6a6acSopenharmony_ci (and 2266cd6a6acSopenharmony_ci fs_type 2276cd6a6acSopenharmony_ci (not file.usermodehelper) 2286cd6a6acSopenharmony_ci ) 2296cd6a6acSopenharmony_ci (not file.proc_security) 2306cd6a6acSopenharmony_ci ) 2316cd6a6acSopenharmony_ci ) 2326cd6a6acSopenharmony_ci ``` 2336cd6a6acSopenharmony_ci 2346cd6a6acSopenharmony_ci The `cps_1 classpermissionset` identifier includes all permissions except `load_policy` and `setenforce`: 2356cd6a6acSopenharmony_ci 2366cd6a6acSopenharmony_ci ```secil 2376cd6a6acSopenharmony_ci (class security (compute_av compute_create compute_member check_context load_policy compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot read_policy)) 2386cd6a6acSopenharmony_ci 2396cd6a6acSopenharmony_ci (classpermission cps_1) 2406cd6a6acSopenharmony_ci 2416cd6a6acSopenharmony_ci (classpermissionset cps_1 (security (not (load_policy setenforce)))) 2426cd6a6acSopenharmony_ci ``` 2436cd6a6acSopenharmony_ci 2446cd6a6acSopenharmony_ci This example includes all permissions in the associated [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset) identifier `security_all_perms`: 2456cd6a6acSopenharmony_ci 2466cd6a6acSopenharmony_ci ```secil 2476cd6a6acSopenharmony_ci (class security (compute_av compute_create compute_member check_context load_policy 2486cd6a6acSopenharmony_ci compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot 2496cd6a6acSopenharmony_ci read_policy) 2506cd6a6acSopenharmony_ci ) 2516cd6a6acSopenharmony_ci 2526cd6a6acSopenharmony_ci (classpermission security_all_perms) 2536cd6a6acSopenharmony_ci 2546cd6a6acSopenharmony_ci (classpermissionset security_all_perms (security (all))) 2556cd6a6acSopenharmony_ci ``` 2566cd6a6acSopenharmony_ci 2576cd6a6acSopenharmony_ci2. The [`categoryset`](cil_mls_labeling_statements.md#categoryset) statement allows `expr_set` to mix names and `expr_key` values of: `and`, `or`, `not`, `xor`, `all`, `range` as shown in the examples. 2586cd6a6acSopenharmony_ci 2596cd6a6acSopenharmony_ci Category expressions are also allowed in [`sensitivitycategory`](cil_mls_labeling_statements.md#sensitivitycategory), [`level`](cil_mls_labeling_statements.md#level), and [`levelrange`](cil_mls_labeling_statements.md#levelrange) statements. 2606cd6a6acSopenharmony_ci 2616cd6a6acSopenharmony_ci3. The [`booleanif`](cil_conditional_statements.md#booleanif) and [`tunableif`](cil_conditional_statements.md#tunableif) statements only allow an `expr_set` to have one `name` or `expr` with `expr_key` values of `and`, `or`, `xor`, `not`, `eq`, `neq` as shown in the examples: 2626cd6a6acSopenharmony_ci 2636cd6a6acSopenharmony_ci ```secil 2646cd6a6acSopenharmony_ci (booleanif disableAudio 2656cd6a6acSopenharmony_ci (false 2666cd6a6acSopenharmony_ci (allow process device.audio_device (chr_file_set (rw_file_perms))) 2676cd6a6acSopenharmony_ci ) 2686cd6a6acSopenharmony_ci ) 2696cd6a6acSopenharmony_ci 2706cd6a6acSopenharmony_ci (booleanif (and (not disableAudio) (not disableAudioCapture)) 2716cd6a6acSopenharmony_ci (true 2726cd6a6acSopenharmony_ci (allow process device.audio_capture_device (chr_file_set (rw_file_perms))) 2736cd6a6acSopenharmony_ci ) 2746cd6a6acSopenharmony_ci ) 2756cd6a6acSopenharmony_ci ``` 2766cd6a6acSopenharmony_ci 2776cd6a6acSopenharmony_ci4. The [`constrain`](cil_constraint_statements.md#constrain), [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain), [`validatetrans`](cil_constraint_statements.md#validatetrans) and [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) statements only allow an `expr_set` to have one `name` or `expr` with `expr_key` values of `and`, `or`, `not`, `all`, `eq`, `neq`, `dom`, `domby`, `incomp`. When `expr_key` is `dom`, `domby` or `incomp`, it must be followed by a string (e.g. `h1`, `l2`) and another string or a set of `name`s. The following examples show CIL constraint statements and their policy language equivalents: 2786cd6a6acSopenharmony_ci 2796cd6a6acSopenharmony_ci ```secil 2806cd6a6acSopenharmony_ci ; Process transition: Require equivalence unless the subject is trusted. 2816cd6a6acSopenharmony_ci (mlsconstrain (process (transition dyntransition)) 2826cd6a6acSopenharmony_ci (or (and (eq h1 h2) (eq l1 l2)) (eq t1 mlstrustedsubject))) 2836cd6a6acSopenharmony_ci 2846cd6a6acSopenharmony_ci ; The equivalent policy language mlsconstrain statememt is: 2856cd6a6acSopenharmony_ci ;mlsconstrain process { transition dyntransition } 2866cd6a6acSopenharmony_ci ; ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject); 2876cd6a6acSopenharmony_ci 2886cd6a6acSopenharmony_ci ; Process read operations: No read up unless trusted. 2896cd6a6acSopenharmony_ci (mlsconstrain (process (getsched getsession getpgid getcap getattr ptrace share)) 2906cd6a6acSopenharmony_ci (or (dom l1 l2) (eq t1 mlstrustedsubject))) 2916cd6a6acSopenharmony_ci 2926cd6a6acSopenharmony_ci ; The equivalent policy language mlsconstrain statememt is: 2936cd6a6acSopenharmony_ci ;mlsconstrain process { getsched getsession getpgid getcap getattr ptrace share } 2946cd6a6acSopenharmony_ci ; (l1 dom l2 or t1 == mlstrustedsubject); 2956cd6a6acSopenharmony_ci ``` 2966cd6a6acSopenharmony_ci 2976cd6a6acSopenharmony_ciName String 2986cd6a6acSopenharmony_ci----------- 2996cd6a6acSopenharmony_ci 3006cd6a6acSopenharmony_ciUsed to define [`macro`](cil_call_macro_statements.md#macro) statement parameter string types: 3016cd6a6acSopenharmony_ci 3026cd6a6acSopenharmony_ci```secil 3036cd6a6acSopenharmony_ci (call macro1("__kmsg__")) 3046cd6a6acSopenharmony_ci 3056cd6a6acSopenharmony_ci (macro macro1 ((string ARG1)) 3066cd6a6acSopenharmony_ci (typetransition audit.process device.device chr_file ARG1 device.klog_device) 3076cd6a6acSopenharmony_ci ) 3086cd6a6acSopenharmony_ci``` 3096cd6a6acSopenharmony_ci 3106cd6a6acSopenharmony_ciAlternatively: 3116cd6a6acSopenharmony_ci 3126cd6a6acSopenharmony_ci```secil 3136cd6a6acSopenharmony_ci (call macro1("__kmsg__")) 3146cd6a6acSopenharmony_ci 3156cd6a6acSopenharmony_ci (macro macro1 ((name ARG1)) 3166cd6a6acSopenharmony_ci (typetransition audit.process device.device chr_file ARG1 device.klog_device) 3176cd6a6acSopenharmony_ci ) 3186cd6a6acSopenharmony_ci``` 3196cd6a6acSopenharmony_ci 3206cd6a6acSopenharmony_ciself 3216cd6a6acSopenharmony_ci---- 3226cd6a6acSopenharmony_ci 3236cd6a6acSopenharmony_ciThe [`self`](cil_reference_guide.md#self) keyword may be used as the target in AVC rule statements, and means that the target is the same as the source as shown in the following example:. 3246cd6a6acSopenharmony_ci 3256cd6a6acSopenharmony_ci```secil 3266cd6a6acSopenharmony_ci (allow unconfined.process self (file (read write))) 3276cd6a6acSopenharmony_ci``` 328