xref: /aosp_15_r20/external/selinux/secilc/docs/cil_xen_statements.md (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard WorkerXen Statements
2*2d543d20SAndroid Build Coastguard Worker==============
3*2d543d20SAndroid Build Coastguard Worker
4*2d543d20SAndroid Build Coastguard WorkerPolicy version 30 introduced the [`devicetreecon`](cil_xen_statements.md#devicetreecon) statement and also expanded the existing I/O memory range to 64 bits in order to support hardware with more than 44 bits of physical address space (32-bit count of 4K pages).
5*2d543d20SAndroid Build Coastguard Worker
6*2d543d20SAndroid Build Coastguard WorkerSee the ["XSM/FLASK Configuration"](http://xenbits.xen.org/docs/4.2-testing/misc/xsm-flask.txt) document for further information ([](http://xenbits.xen.org/docs/4.2-testing/misc/xsm-flask.txt))
7*2d543d20SAndroid Build Coastguard Worker
8*2d543d20SAndroid Build Coastguard Workeriomemcon
9*2d543d20SAndroid Build Coastguard Worker--------
10*2d543d20SAndroid Build Coastguard Worker
11*2d543d20SAndroid Build Coastguard WorkerLabel i/o memory. This may be a single memory location or a range.
12*2d543d20SAndroid Build Coastguard Worker
13*2d543d20SAndroid Build Coastguard Worker**Statement definition:**
14*2d543d20SAndroid Build Coastguard Worker
15*2d543d20SAndroid Build Coastguard Worker```secil
16*2d543d20SAndroid Build Coastguard Worker    (iomemcon mem_addr|(mem_low mem_high) context_id)
17*2d543d20SAndroid Build Coastguard Worker```
18*2d543d20SAndroid Build Coastguard Worker
19*2d543d20SAndroid Build Coastguard Worker**Where:**
20*2d543d20SAndroid Build Coastguard Worker
21*2d543d20SAndroid Build Coastguard Worker<table>
22*2d543d20SAndroid Build Coastguard Worker<colgroup>
23*2d543d20SAndroid Build Coastguard Worker<col width="25%" />
24*2d543d20SAndroid Build Coastguard Worker<col width="75%" />
25*2d543d20SAndroid Build Coastguard Worker</colgroup>
26*2d543d20SAndroid Build Coastguard Worker<tbody>
27*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
28*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>iomemcon</code></p></td>
29*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>iomemcon</code> keyword.</p></td>
30*2d543d20SAndroid Build Coastguard Worker</tr>
31*2d543d20SAndroid Build Coastguard Worker<tr class="even">
32*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>mem_addr |</code></p>
33*2d543d20SAndroid Build Coastguard Worker<p><code>(mem_low mem_high)</code></p></td>
34*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A single memory address to apply the context, or a range of addresses.</p>
35*2d543d20SAndroid Build Coastguard Worker<p>The entries must consist of numerics <code>[0-9]</code>.</p></td>
36*2d543d20SAndroid Build Coastguard Worker</tr>
37*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
38*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>context_id</code></p></td>
39*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A previously declared <code>context</code> identifier or an anonymous security context (<code>user role type levelrange</code>), the range MUST be defined whether the policy is MLS/MCS enabled or not.</p></td>
40*2d543d20SAndroid Build Coastguard Worker</tr>
41*2d543d20SAndroid Build Coastguard Worker</tbody>
42*2d543d20SAndroid Build Coastguard Worker</table>
43*2d543d20SAndroid Build Coastguard Worker
44*2d543d20SAndroid Build Coastguard Worker**Example:**
45*2d543d20SAndroid Build Coastguard Worker
46*2d543d20SAndroid Build Coastguard WorkerAn anonymous context for a memory address range of `0xfebe0-0xfebff`:
47*2d543d20SAndroid Build Coastguard Worker
48*2d543d20SAndroid Build Coastguard Worker```secil
49*2d543d20SAndroid Build Coastguard Worker    (iomemcon (1043424 1043455) (unconfined.user object_r unconfined.object low_low))
50*2d543d20SAndroid Build Coastguard Worker```
51*2d543d20SAndroid Build Coastguard Worker
52*2d543d20SAndroid Build Coastguard Workerioportcon
53*2d543d20SAndroid Build Coastguard Worker---------
54*2d543d20SAndroid Build Coastguard Worker
55*2d543d20SAndroid Build Coastguard WorkerLabel i/o ports. This may be a single port or a range.
56*2d543d20SAndroid Build Coastguard Worker
57*2d543d20SAndroid Build Coastguard Worker**Statement definition:**
58*2d543d20SAndroid Build Coastguard Worker
59*2d543d20SAndroid Build Coastguard Worker```secil
60*2d543d20SAndroid Build Coastguard Worker    (ioportcon port|(port_low port_high) context_id)
61*2d543d20SAndroid Build Coastguard Worker```
62*2d543d20SAndroid Build Coastguard Worker
63*2d543d20SAndroid Build Coastguard Worker**Where:**
64*2d543d20SAndroid Build Coastguard Worker
65*2d543d20SAndroid Build Coastguard Worker<table>
66*2d543d20SAndroid Build Coastguard Worker<colgroup>
67*2d543d20SAndroid Build Coastguard Worker<col width="27%" />
68*2d543d20SAndroid Build Coastguard Worker<col width="72%" />
69*2d543d20SAndroid Build Coastguard Worker</colgroup>
70*2d543d20SAndroid Build Coastguard Worker<tbody>
71*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
72*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>ioportcon</code></p></td>
73*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>ioportcon</code> keyword.</p></td>
74*2d543d20SAndroid Build Coastguard Worker</tr>
75*2d543d20SAndroid Build Coastguard Worker<tr class="even">
76*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>port |</code></p>
77*2d543d20SAndroid Build Coastguard Worker<p><code>(port_low port_high)</code></p></td>
78*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A single port to apply the context, or a range of ports.</p>
79*2d543d20SAndroid Build Coastguard Worker<p>The entries must consist of numerics <code>[0-9]</code>.</p></td>
80*2d543d20SAndroid Build Coastguard Worker</tr>
81*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
82*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>context_id</code></p></td>
83*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A previously declared <code>context</code> identifier or an anonymous security context (<code>user role type levelrange</code>), the range MUST be defined whether the policy is MLS/MCS enabled or not.</p></td>
84*2d543d20SAndroid Build Coastguard Worker</tr>
85*2d543d20SAndroid Build Coastguard Worker</tbody>
86*2d543d20SAndroid Build Coastguard Worker</table>
87*2d543d20SAndroid Build Coastguard Worker
88*2d543d20SAndroid Build Coastguard Worker**Example:**
89*2d543d20SAndroid Build Coastguard Worker
90*2d543d20SAndroid Build Coastguard WorkerAn anonymous context for a single port of :`0xecc0`:
91*2d543d20SAndroid Build Coastguard Worker
92*2d543d20SAndroid Build Coastguard Worker```secil
93*2d543d20SAndroid Build Coastguard Worker    (ioportcon 60608 (unconfined.user object_r unconfined.object low_low))
94*2d543d20SAndroid Build Coastguard Worker```
95*2d543d20SAndroid Build Coastguard Worker
96*2d543d20SAndroid Build Coastguard Workerpcidevicecon
97*2d543d20SAndroid Build Coastguard Worker------------
98*2d543d20SAndroid Build Coastguard Worker
99*2d543d20SAndroid Build Coastguard WorkerLabel a PCI device.
100*2d543d20SAndroid Build Coastguard Worker
101*2d543d20SAndroid Build Coastguard Worker**Statement definition:**
102*2d543d20SAndroid Build Coastguard Worker
103*2d543d20SAndroid Build Coastguard Worker```secil
104*2d543d20SAndroid Build Coastguard Worker    (pcidevicecon device context_id)
105*2d543d20SAndroid Build Coastguard Worker```
106*2d543d20SAndroid Build Coastguard Worker
107*2d543d20SAndroid Build Coastguard Worker**Where:**
108*2d543d20SAndroid Build Coastguard Worker
109*2d543d20SAndroid Build Coastguard Worker<table>
110*2d543d20SAndroid Build Coastguard Worker<colgroup>
111*2d543d20SAndroid Build Coastguard Worker<col width="25%" />
112*2d543d20SAndroid Build Coastguard Worker<col width="75%" />
113*2d543d20SAndroid Build Coastguard Worker</colgroup>
114*2d543d20SAndroid Build Coastguard Worker<tbody>
115*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
116*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>pcidevicecon</code></p></td>
117*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>pcidevicecon</code> keyword.</p></td>
118*2d543d20SAndroid Build Coastguard Worker</tr>
119*2d543d20SAndroid Build Coastguard Worker<tr class="even">
120*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>device</code></p></td>
121*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The device number.The entries must consist of numerics <code>[0-9]</code>.</p></td>
122*2d543d20SAndroid Build Coastguard Worker</tr>
123*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
124*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>context_id</code></p></td>
125*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A previously declared <code>context</code> identifier or an anonymous security context (<code>user role type levelrange</code>), the range MUST be defined whether the policy is MLS/MCS enabled or not.</p></td>
126*2d543d20SAndroid Build Coastguard Worker</tr>
127*2d543d20SAndroid Build Coastguard Worker</tbody>
128*2d543d20SAndroid Build Coastguard Worker</table>
129*2d543d20SAndroid Build Coastguard Worker
130*2d543d20SAndroid Build Coastguard Worker**Example:**
131*2d543d20SAndroid Build Coastguard Worker
132*2d543d20SAndroid Build Coastguard WorkerAn anonymous context for a pci device address of `0xc800`:
133*2d543d20SAndroid Build Coastguard Worker
134*2d543d20SAndroid Build Coastguard Worker```secil
135*2d543d20SAndroid Build Coastguard Worker    (pcidevicecon 51200 (unconfined.user object_r unconfined.object low_low))
136*2d543d20SAndroid Build Coastguard Worker```
137*2d543d20SAndroid Build Coastguard Worker
138*2d543d20SAndroid Build Coastguard Workerpirqcon
139*2d543d20SAndroid Build Coastguard Worker-------
140*2d543d20SAndroid Build Coastguard Worker
141*2d543d20SAndroid Build Coastguard WorkerLabel an interrupt level.
142*2d543d20SAndroid Build Coastguard Worker
143*2d543d20SAndroid Build Coastguard Worker**Statement definition:**
144*2d543d20SAndroid Build Coastguard Worker
145*2d543d20SAndroid Build Coastguard Worker```secil
146*2d543d20SAndroid Build Coastguard Worker    (pirqcon irq_level context_id)
147*2d543d20SAndroid Build Coastguard Worker```
148*2d543d20SAndroid Build Coastguard Worker
149*2d543d20SAndroid Build Coastguard Worker**Where:**
150*2d543d20SAndroid Build Coastguard Worker
151*2d543d20SAndroid Build Coastguard Worker<table>
152*2d543d20SAndroid Build Coastguard Worker<colgroup>
153*2d543d20SAndroid Build Coastguard Worker<col width="25%" />
154*2d543d20SAndroid Build Coastguard Worker<col width="75%" />
155*2d543d20SAndroid Build Coastguard Worker</colgroup>
156*2d543d20SAndroid Build Coastguard Worker<tbody>
157*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
158*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>pirqcon</code></p></td>
159*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>pirqcon</code> keyword.</p></td>
160*2d543d20SAndroid Build Coastguard Worker</tr>
161*2d543d20SAndroid Build Coastguard Worker<tr class="even">
162*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>irq_level</code></p></td>
163*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The interrupt request number. The entries must consist of numerics <code>[0-9]</code>.</p></td>
164*2d543d20SAndroid Build Coastguard Worker</tr>
165*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
166*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>context_id</code></p></td>
167*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A previously declared <code>context</code> identifier or an anonymous security context (<code>user role type levelrange</code>), the range MUST be defined whether the policy is MLS/MCS enabled or not.</p></td>
168*2d543d20SAndroid Build Coastguard Worker</tr>
169*2d543d20SAndroid Build Coastguard Worker</tbody>
170*2d543d20SAndroid Build Coastguard Worker</table>
171*2d543d20SAndroid Build Coastguard Worker
172*2d543d20SAndroid Build Coastguard Worker**Example:**
173*2d543d20SAndroid Build Coastguard Worker
174*2d543d20SAndroid Build Coastguard WorkerAn anonymous context for IRQ 33:
175*2d543d20SAndroid Build Coastguard Worker
176*2d543d20SAndroid Build Coastguard Worker```secil
177*2d543d20SAndroid Build Coastguard Worker    (pirqcon 33 (unconfined.user object_r unconfined.object low_low))
178*2d543d20SAndroid Build Coastguard Worker```
179*2d543d20SAndroid Build Coastguard Worker
180*2d543d20SAndroid Build Coastguard Workerdevicetreecon
181*2d543d20SAndroid Build Coastguard Worker-------------
182*2d543d20SAndroid Build Coastguard Worker
183*2d543d20SAndroid Build Coastguard WorkerLabel device tree nodes.
184*2d543d20SAndroid Build Coastguard Worker
185*2d543d20SAndroid Build Coastguard Worker**Statement definition:**
186*2d543d20SAndroid Build Coastguard Worker
187*2d543d20SAndroid Build Coastguard Worker```secil
188*2d543d20SAndroid Build Coastguard Worker    (devicetreecon path context_id)
189*2d543d20SAndroid Build Coastguard Worker```
190*2d543d20SAndroid Build Coastguard Worker
191*2d543d20SAndroid Build Coastguard Worker**Where:**
192*2d543d20SAndroid Build Coastguard Worker
193*2d543d20SAndroid Build Coastguard Worker<table>
194*2d543d20SAndroid Build Coastguard Worker<colgroup>
195*2d543d20SAndroid Build Coastguard Worker<col width="25%" />
196*2d543d20SAndroid Build Coastguard Worker<col width="75%" />
197*2d543d20SAndroid Build Coastguard Worker</colgroup>
198*2d543d20SAndroid Build Coastguard Worker<tbody>
199*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
200*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>devicetreecon</code></p></td>
201*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>devicetreecon</code> keyword.</p></td>
202*2d543d20SAndroid Build Coastguard Worker</tr>
203*2d543d20SAndroid Build Coastguard Worker<tr class="even">
204*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>path</code></p></td>
205*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The device tree path. If this contains spaces enclose within <code>&quot;&quot;</code>.</p></td>
206*2d543d20SAndroid Build Coastguard Worker</tr>
207*2d543d20SAndroid Build Coastguard Worker<tr class="odd">
208*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>context_id</code></p></td>
209*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A previously declared <code>context</code> identifier or an anonymous security context (<code>user role type levelrange</code>), the range MUST be defined whether the policy is MLS/MCS enabled or not.</p></td>
210*2d543d20SAndroid Build Coastguard Worker</tr>
211*2d543d20SAndroid Build Coastguard Worker</tbody>
212*2d543d20SAndroid Build Coastguard Worker</table>
213*2d543d20SAndroid Build Coastguard Worker
214*2d543d20SAndroid Build Coastguard Worker**Example:**
215*2d543d20SAndroid Build Coastguard Worker
216*2d543d20SAndroid Build Coastguard WorkerAn anonymous context for the specified path:
217*2d543d20SAndroid Build Coastguard Worker
218*2d543d20SAndroid Build Coastguard Worker```secil
219*2d543d20SAndroid Build Coastguard Worker    (devicetreecon "/this is/a/path" (unconfined.user object_r unconfined.object low_low))
220*2d543d20SAndroid Build Coastguard Worker```
221