← Documents Documentation/security/ipe.rst GitHub 원문 ↗

Linux 6.18.37 · Security

Integrity Policy Enforcement(IPE) 커널 설계

IPE의 역사적 동기, 일반 텍스트·서명 정책, 명시적 DEFAULT, 부팅·갱신·rollback 모델과 커널 구현·테스트를 설명합니다.

Source pathDocumentation/security/ipe.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

ipe.rst:1-446

IPE는 무결성을 직접 제공하지 않고 DM-Verity·fs-verity 등의 claim을 일반 텍스트 정책으로 집행하는 LSM입니다. 문서는 정책 서명과 update, operation별 명시적 DEFAULT, 부팅과 rollback의 경계, 익명 메모리 및 securityfs 구현을 설계 근거와 함께 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 Integrity Policy Enforcement (IPE) - Kernel Documentation
4 =========================================================
5
6 .. NOTE::
7
8 This is documentation targeted at developers, instead of administrators.
9 If you're looking for documentation on the usage of IPE, please see
10 :doc:`IPE admin guide </admin-guide/LSM/ipe>`.
11
12 Historical Motivation
13 ---------------------
14
15 The original issue that prompted IPE's implementation was the creation
16 of a locked-down system. This system would be born-secure, and have
17 strong integrity guarantees over both the executable code, and specific
18 *data files* on the system, that were critical to its function. These
19 specific data files would not be readable unless they passed integrity
20 policy. A mandatory access control system would be present, and
21 as a result, xattrs would have to be protected. This lead to a selection
22 of what would provide the integrity claims. At the time, there were two
23 main mechanisms considered that could guarantee integrity for the system
24 with these requirements:
25
26 1. IMA + EVM Signatures
27 2. DM-Verity
28
29 Both options were carefully considered, however the choice to use DM-Verity
30 over IMA+EVM as the *integrity mechanism* in the original use case of IPE
31 was due to three main reasons:
32
33 1. Protection of additional attack vectors:
34
35 * With IMA+EVM, without an encryption solution, the system is vulnerable
36 to offline attack against the aforementioned specific data files.
37
38 Unlike executables, read operations (like those on the protected data
39 files), cannot be enforced to be globally integrity verified. This means
40 there must be some form of selector to determine whether a read should
41 enforce the integrity policy, or it should not.
42
43 At the time, this was done with mandatory access control labels. An IMA
44 policy would indicate what labels required integrity verification, which
45 presented an issue: EVM would protect the label, but if an attacker could
46 modify filesystem offline, the attacker could wipe all the xattrs -
47 including the SELinux labels that would be used to determine whether the
48 file should be subject to integrity policy.
49
50 With DM-Verity, as the xattrs are saved as part of the Merkel tree, if
51 offline mount occurs against the filesystem protected by dm-verity, the
52 checksum no longer matches and the file fails to be read.
53
54 * As userspace binaries are paged in Linux, dm-verity also offers the
55 additional protection against a hostile block device. In such an attack,
56 the block device reports the appropriate content for the IMA hash
57 initially, passing the required integrity check. Then, on the page fault
58 that accesses the real data, will report the attacker's payload. Since
59 dm-verity will check the data when the page fault occurs (and the disk
60 access), this attack is mitigated.
61
62 2. Performance:
63
64 * dm-verity provides integrity verification on demand as blocks are
65 read versus requiring the entire file being read into memory for
66 validation.
67
68 3. Simplicity of signing:
69
70 * No need for two signatures (IMA, then EVM): one signature covers
71 an entire block device.
72 * Signatures can be stored externally to the filesystem metadata.
73 * The signature supports an x.509-based signing infrastructure.
74
75 The next step was to choose a *policy* to enforce the integrity mechanism.
76 The minimum requirements for the policy were:
77
78 1. The policy itself must be integrity verified (preventing trivial
79 attack against it).
80 2. The policy itself must be resistant to rollback attacks.
81 3. The policy enforcement must have a permissive-like mode.
82 4. The policy must be able to be updated, in its entirety, without
83 a reboot.
84 5. Policy updates must be atomic.
85 6. The policy must support *revocations* of previously authored
86 components.
87 7. The policy must be auditable, at any point-of-time.
88
89 IMA, as the only integrity policy mechanism at the time, was
90 considered against these list of requirements, and did not fulfill
91 all of the minimum requirements. Extending IMA to cover these
92 requirements was considered, but ultimately discarded for a
93 two reasons:
94
95 1. Regression risk; many of these changes would result in
96 dramatic code changes to IMA, which is already present in the
97 kernel, and therefore might impact users.
98
99 2. IMA was used in the system for measurement and attestation;
100 separation of measurement policy from local integrity policy
101 enforcement was considered favorable.
102
103 Due to these reasons, it was decided that a new LSM should be created,
104 whose responsibility would be only the local integrity policy enforcement.
105
106 Role and Scope
107 --------------
108
109 IPE, as its name implies, is fundamentally an integrity policy enforcement
110 solution; IPE does not mandate how integrity is provided, but instead
111 leaves that decision to the system administrator to set the security bar,
112 via the mechanisms that they select that suit their individual needs.
113 There are several different integrity solutions that provide a different
114 level of security guarantees; and IPE allows sysadmins to express policy for
115 theoretically all of them.
116
117 IPE does not have an inherent mechanism to ensure integrity on its own.
118 Instead, there are more effective layers available for building systems that
119 can guarantee integrity. It's important to note that the mechanism for proving
120 integrity is independent of the policy for enforcing that integrity claim.
121
122 Therefore, IPE was designed around:
123
124 1. Easy integrations with integrity providers.
125 2. Ease of use for platform administrators/sysadmins.
126
127 Design Rationale:
128 -----------------
129
130 IPE was designed after evaluating existing integrity policy solutions
131 in other operating systems and environments. In this survey of other
132 implementations, there were a few pitfalls identified:
133
134 1. Policies were not readable by humans, usually requiring a binary
135 intermediary format.
136 2. A single, non-customizable action was implicitly taken as a default.
137 3. Debugging the policy required manual steps to determine what rule was violated.
138 4. Authoring a policy required an in-depth knowledge of the larger system,
139 or operating system.
140
141 IPE attempts to avoid all of these pitfalls.
142
143 Policy
144 ~~~~~~
145
146 Plain Text
147 ^^^^^^^^^^
148
149 IPE's policy is plain-text. This introduces slightly larger policy files than
150 other LSMs, but solves two major problems that occurs with some integrity policy
151 solutions on other platforms.
152
153 The first issue is one of code maintenance and duplication. To author policies,
154 the policy has to be some form of string representation (be it structured,
155 through XML, JSON, YAML, etcetera), to allow the policy author to understand
156 what is being written. In a hypothetical binary policy design, a serializer
157 is necessary to write the policy from the human readable form, to the binary
158 form, and a deserializer is needed to interpret the binary form into a data
159 structure in the kernel.
160
161 Eventually, another deserializer will be needed to transform the binary from
162 back into the human-readable form with as much information preserved. This is because a
163 user of this access control system will have to keep a lookup table of a checksum
164 and the original file itself to try to understand what policies have been deployed
165 on this system and what policies have not. For a single user, this may be alright,
166 as old policies can be discarded almost immediately after the update takes hold.
167 For users that manage computer fleets in the thousands, if not hundreds of thousands,
168 with multiple different operating systems, and multiple different operational needs,
169 this quickly becomes an issue, as stale policies from years ago may be present,
170 quickly resulting in the need to recover the policy or fund extensive infrastructure
171 to track what each policy contains.
172
173 With now three separate serializer/deserializers, maintenance becomes costly. If the
174 policy avoids the binary format, there is only one required serializer: from the
175 human-readable form to the data structure in kernel, saving on code maintenance,
176 and retaining operability.
177
178 The second issue with a binary format is one of transparency. As IPE controls
179 access based on the trust of the system's resources, it's policy must also be
180 trusted to be changed. This is done through signatures, resulting in needing
181 signing as a process. Signing, as a process, is typically done with a
182 high security bar, as anything signed can be used to attack integrity
183 enforcement systems. It is also important that, when signing something, that
184 the signer is aware of what they are signing. A binary policy can cause
185 obfuscation of that fact; what signers see is an opaque binary blob. A
186 plain-text policy, on the other hand, the signers see the actual policy
187 submitted for signing.
188
189 Boot Policy
190 ~~~~~~~~~~~
191
192 IPE, if configured appropriately, is able to enforce a policy as soon as a
193 kernel is booted and usermode starts. That implies some level of storage
194 of the policy to apply the minute usermode starts. Generally, that storage
195 can be handled in one of three ways:
196
197 1. The policy file(s) live on disk and the kernel loads the policy prior
198 to an code path that would result in an enforcement decision.
199 2. The policy file(s) are passed by the bootloader to the kernel, who
200 parses the policy.
201 3. There is a policy file that is compiled into the kernel that is
202 parsed and enforced on initialization.
203
204 The first option has problems: the kernel reading files from userspace
205 is typically discouraged and very uncommon in the kernel.
206
207 The second option also has problems: Linux supports a variety of bootloaders
208 across its entire ecosystem - every bootloader would have to support this
209 new methodology or there must be an independent source. It would likely
210 result in more drastic changes to the kernel startup than necessary.
211
212 The third option is the best but it's important to be aware that the policy
213 will take disk space against the kernel it's compiled in. It's important to
214 keep this policy generalized enough that userspace can load a new, more
215 complicated policy, but restrictive enough that it will not overauthorize
216 and cause security issues.
217
218 The initramfs provides a way that this bootup path can be established. The
219 kernel starts with a minimal policy, that trusts the initramfs only. Inside
220 the initramfs, when the real rootfs is mounted, but not yet transferred to,
221 it deploys and activates a policy that trusts the new root filesystem.
222 This prevents overauthorization at any step, and keeps the kernel policy
223 to a minimal size.
224
225 Startup
226 ^^^^^^^
227
228 Not every system, however starts with an initramfs, so the startup policy
229 compiled into the kernel will need some flexibility to express how trust
230 is established for the next phase of the bootup. To this end, if we just
231 make the compiled-in policy a full IPE policy, it allows system builders
232 to express the first stage bootup requirements appropriately.
233
234 Updatable, Rebootless Policy
235 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236
237 As requirements change over time (vulnerabilities are found in previously
238 trusted applications, keys roll, etcetera). Updating a kernel to change the
239 meet those security goals is not always a suitable option, as updates are not
240 always risk-free, and blocking a security update leaves systems vulnerable.
241 This means IPE requires a policy that can be completely updated (allowing
242 revocations of existing policy) from a source external to the kernel (allowing
243 policies to be updated without updating the kernel).
244
245 Additionally, since the kernel is stateless between invocations, and reading
246 policy files off the disk from kernel space is a bad idea(tm), then the
247 policy updates have to be done rebootlessly.
248
249 To allow an update from an external source, it could be potentially malicious,
250 so this policy needs to have a way to be identified as trusted. This is
251 done via a signature chained to a trust source in the kernel. Arbitrarily,
252 this is the ``SYSTEM_TRUSTED_KEYRING``, a keyring that is initially
253 populated at kernel compile-time, as this matches the expectation that the
254 author of the compiled-in policy described above is the same entity that can
255 deploy policy updates.
256
257 Anti-Rollback / Anti-Replay
258 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
259
260 Over time, vulnerabilities are found and trusted resources may not be
261 trusted anymore. IPE's policy has no exception to this. There can be
262 instances where a mistaken policy author deploys an insecure policy,
263 before correcting it with a secure policy.
264
265 Assuming that as soon as the insecure policy is signed, and an attacker
266 acquires the insecure policy, IPE needs a way to prevent rollback
267 from the secure policy update to the insecure policy update.
268
269 Initially, IPE's policy can have a policy_version that states the
270 minimum required version across all policies that can be active on
271 the system. This will prevent rollback while the system is live.
272
273 .. WARNING::
274
275 However, since the kernel is stateless across boots, this policy
276 version will be reset to 0.0.0 on the next boot. System builders
277 need to be aware of this, and ensure the new secure policies are
278 deployed ASAP after a boot to ensure that the window of
279 opportunity is minimal for an attacker to deploy the insecure policy.
280
281 Implicit Actions:
282 ~~~~~~~~~~~~~~~~~
283
284 The issue of implicit actions only becomes visible when you consider
285 a mixed level of security bars across multiple operations in a system.
286 For example, consider a system that has strong integrity guarantees
287 over both the executable code, and specific *data files* on the system,
288 that were critical to its function. In this system, three types of policies
289 are possible:
290
291 1. A policy in which failure to match any rules in the policy results
292 in the action being denied.
293 2. A policy in which failure to match any rules in the policy results
294 in the action being allowed.
295 3. A policy in which the action taken when no rules are matched is
296 specified by the policy author.
297
298 The first option could make a policy like this::
299
300 op=EXECUTE integrity_verified=YES action=ALLOW
301
302 In the example system, this works well for the executables, as all
303 executables should have integrity guarantees, without exception. The
304 issue becomes with the second requirement about specific data files.
305 This would result in a policy like this (assuming each line is
306 evaluated in order)::
307
308 op=EXECUTE integrity_verified=YES action=ALLOW
309
310 op=READ integrity_verified=NO label=critical_t action=DENY
311 op=READ action=ALLOW
312
313 This is somewhat clear if you read the docs, understand the policy
314 is executed in order and that the default is a denial; however, the
315 last line effectively changes that default to an ALLOW. This is
316 required, because in a realistic system, there are some unverified
317 reads (imagine appending to a log file).
318
319 The second option, matching no rules results in an allow, is clearer
320 for the specific data files::
321
322 op=READ integrity_verified=NO label=critical_t action=DENY
323
324 And, like the first option, falls short with the execution scenario,
325 effectively needing to override the default::
326
327 op=EXECUTE integrity_verified=YES action=ALLOW
328 op=EXECUTE action=DENY
329
330 op=READ integrity_verified=NO label=critical_t action=DENY
331
332 This leaves the third option. Instead of making users be clever
333 and override the default with an empty rule, force the end-user
334 to consider what the appropriate default should be for their
335 scenario and explicitly state it::
336
337 DEFAULT op=EXECUTE action=DENY
338 op=EXECUTE integrity_verified=YES action=ALLOW
339
340 DEFAULT op=READ action=ALLOW
341 op=READ integrity_verified=NO label=critical_t action=DENY
342
343 Policy Debugging:
344 ~~~~~~~~~~~~~~~~~
345
346 When developing a policy, it is useful to know what line of the policy
347 is being violated to reduce debugging costs; narrowing the scope of the
348 investigation to the exact line that resulted in the action. Some integrity
349 policy systems do not provide this information, instead providing the
350 information that was used in the evaluation. This then requires a correlation
351 with the policy to evaluate what went wrong.
352
353 Instead, IPE just emits the rule that was matched. This limits the scope
354 of the investigation to the exact policy line (in the case of a specific
355 rule), or the section (in the case of a DEFAULT). This decreases iteration
356 and investigation times when policy failures are observed while evaluating
357 policies.
358
359 IPE's policy engine is also designed in a way that it makes it obvious to
360 a human of how to investigate a policy failure. Each line is evaluated in
361 the sequence that is written, so the algorithm is very simple to follow
362 for humans to recreate the steps and could have caused the failure. In other
363 surveyed systems, optimizations occur (sorting rules, for instance) when loading
364 the policy. In those systems, it requires multiple steps to debug, and the
365 algorithm may not always be clear to the end-user without reading the code first.
366
367 Simplified Policy:
368 ~~~~~~~~~~~~~~~~~~
369
370 Finally, IPE's policy is designed for sysadmins, not kernel developers. Instead
371 of covering individual LSM hooks (or syscalls), IPE covers operations. This means
372 instead of sysadmins needing to know that the syscalls ``mmap``, ``mprotect``,
373 ``execve``, and ``uselib`` must have rules protecting them, they must simple know
374 that they want to restrict code execution. This limits the amount of bypasses that
375 could occur due to a lack of knowledge of the underlying system; whereas the
376 maintainers of IPE, being kernel developers can make the correct choice to determine
377 whether something maps to these operations, and under what conditions.
378
379 Implementation Notes
380 --------------------
381
382 Anonymous Memory
383 ~~~~~~~~~~~~~~~~
384
385 Anonymous memory isn't treated any differently from any other access in IPE.
386 When anonymous memory is mapped with ``+X``, it still comes into the ``file_mmap``
387 or ``file_mprotect`` hook, but with a ``NULL`` file object. This is submitted to
388 the evaluation, like any other file. However, all current trust properties will
389 evaluate to false, as they are all file-based and the operation is not
390 associated with a file.
391
392 .. WARNING::
393
394 This also occurs with the ``kernel_load_data`` hook, when the kernel is
395 loading data from a userspace buffer that is not backed by a file. In this
396 scenario all current trust properties will also evaluate to false.
397
398 Securityfs Interface
399 ~~~~~~~~~~~~~~~~~~~~
400
401 The per-policy securityfs tree is somewhat unique. For example, for
402 a standard securityfs policy tree::
403
404 MyPolicy
405 |- active
406 |- delete
407 |- name
408 |- pkcs7
409 |- policy
410 |- update
411 |- version
412
413 The policy is stored in the ``->i_private`` data of the MyPolicy inode.
414
415 Tests
416 -----
417
418 IPE has KUnit Tests for the policy parser. Recommended kunitconfig::
419
420 CONFIG_KUNIT=y
421 CONFIG_SECURITY=y
422 CONFIG_SECURITYFS=y
423 CONFIG_PKCS7_MESSAGE_PARSER=y
424 CONFIG_SYSTEM_DATA_VERIFICATION=y
425 CONFIG_FS_VERITY=y
426 CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
427 CONFIG_BLOCK=y
428 CONFIG_MD=y
429 CONFIG_BLK_DEV_DM=y
430 CONFIG_DM_VERITY=y
431 CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
432 CONFIG_NET=y
433 CONFIG_AUDIT=y
434 CONFIG_AUDITSYSCALL=y
435 CONFIG_BLK_DEV_INITRD=y
436
437 CONFIG_SECURITY_IPE=y
438 CONFIG_IPE_PROP_DM_VERITY=y
439 CONFIG_IPE_PROP_DM_VERITY_SIGNATURE=y
440 CONFIG_IPE_PROP_FS_VERITY=y
441 CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG=y
442 CONFIG_SECURITY_IPE_KUNIT_TEST=y
443
444 In addition, IPE has a python based integration
445 `test suite <https://github.com/microsoft/ipe/tree/test-suite>`_ that
446 can test both user interfaces and enforcement functionalities.
447

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

개발자용 IPE 문서

1-11

GPL-2.0으로 배포되는 Integrity Policy Enforcement(IPE) 커널 개발 문서다. 관리자용 사용법이 아니라 설계와 구현을 설명하며, 실제 운용 방법은 `IPE admin guide </admin-guide/LSM/ipe>`를 참조해야 한다.

.. SPDX-License-Identifier: GPL-2.0

Integrity Policy Enforcement (IPE) - Kernel Documentation
=========================================================

.. NOTE::

   This is documentation targeted at developers, instead of administrators.
   If you're looking for documentation on the usage of IPE, please see
   :doc:`IPE admin guide </admin-guide/LSM/ipe>`.

잠긴 시스템과 DM-Verity 선택

12-74

IPE 구현의 출발점은 부팅 순간부터 안전하며 실행 코드와 기능상 중요한 특정 데이터 파일에 강한 무결성 보장을 제공하는 locked-down 시스템이었다. 보호 대상 데이터는 무결성 정책을 통과해야 읽을 수 있어야 했고, 강제 접근 제어가 존재하므로 xattr도 보호해야 했다. 당시 후보는 IMA+EVM 서명과 DM-Verity였다.

원래 IPE 사용 사례에서 DM-Verity를 선택한 첫 이유는 추가 공격 경로의 방어다. IMA+EVM만 사용하고 암호화하지 않으면 보호 데이터 파일을 대상으로 한 오프라인 공격에 노출된다. 실행과 달리 모든 read에 무결성 검사를 강제할 수 없으므로 SELinux 같은 MAC 레이블로 보호 대상을 고를 수 있지만, 공격자가 파일 시스템을 오프라인으로 수정해 xattr와 레이블을 지우면 선택 기준 자체를 제거할 수 있다. DM-Verity는 xattr도 Merkle tree 일부로 저장하므로 오프라인 수정 시 checksum이 맞지 않아 읽기가 실패한다.

DM-Verity는 hostile block device가 최초 IMA hash 검사에는 정상 내용을 주고 실제 page fault에서는 공격 payload를 돌려주는 공격도 줄인다. 사용 공간 바이너리는 paging되지만 DM-Verity는 page fault의 디스크 접근 때 블록을 다시 검증한다. 또한 전체 파일을 메모리에 읽어 검증하는 대신 블록을 읽을 때 필요에 따라 검증하므로 성능상 이점이 있다.

서명 절차도 단순하다. IMA와 EVM의 두 서명 대신 하나의 서명이 전체 블록 장치를 덮고, 서명을 파일 시스템 메타데이터 밖에 둘 수 있으며 X.509 기반 서명 인프라를 지원한다.

DM-Verity 선택 근거
근거효과
공격 경로 보호오프라인 xattr 변조와 hostile block device 대응
성능읽는 블록을 요청 시점에 검증
서명 단순성블록 장치 전체를 한 서명으로 보호

원래 IPE 시스템에서 IMA+EVM 대신 DM-Verity를 고른 세 축이다.

Historical Motivation
---------------------

The original issue that prompted IPE's implementation was the creation
of a locked-down system. This system would be born-secure, and have
strong integrity guarantees over both the executable code, and specific
*data files* on the system, that were critical to its function. These
specific data files would not be readable unless they passed integrity
policy. A mandatory access control system would be present, and
as a result, xattrs would have to be protected. This lead to a selection
of what would provide the integrity claims. At the time, there were two
main mechanisms considered that could guarantee integrity for the system
with these requirements:

  1. IMA + EVM Signatures
  2. DM-Verity

Both options were carefully considered, however the choice to use DM-Verity
over IMA+EVM as the *integrity mechanism* in the original use case of IPE
was due to three main reasons:

  1. Protection of additional attack vectors:

    * With IMA+EVM, without an encryption solution, the system is vulnerable
      to offline attack against the aforementioned specific data files.

      Unlike executables, read operations (like those on the protected data
      files), cannot be enforced to be globally integrity verified. This means
      there must be some form of selector to determine whether a read should
      enforce the integrity policy, or it should not.

      At the time, this was done with mandatory access control labels. An IMA
      policy would indicate what labels required integrity verification, which
      presented an issue: EVM would protect the label, but if an attacker could
      modify filesystem offline, the attacker could wipe all the xattrs -
      including the SELinux labels that would be used to determine whether the
      file should be subject to integrity policy.

      With DM-Verity, as the xattrs are saved as part of the Merkel tree, if
      offline mount occurs against the filesystem protected by dm-verity, the
      checksum no longer matches and the file fails to be read.

    * As userspace binaries are paged in Linux, dm-verity also offers the
      additional protection against a hostile block device. In such an attack,
      the block device reports the appropriate content for the IMA hash
      initially, passing the required integrity check. Then, on the page fault
      that accesses the real data, will report the attacker's payload. Since
      dm-verity will check the data when the page fault occurs (and the disk
      access), this attack is mitigated.

  2. Performance:

    * dm-verity provides integrity verification on demand as blocks are
      read versus requiring the entire file being read into memory for
      validation.

  3. Simplicity of signing:

    * No need for two signatures (IMA, then EVM): one signature covers
      an entire block device.
    * Signatures can be stored externally to the filesystem metadata.
    * The signature supports an x.509-based signing infrastructure.

무결성 정책의 최소 요구사항

75-105

무결성 메커니즘을 선택한 다음에는 이를 집행할 정책이 필요했다. 정책 자체의 무결성 검증과 rollback 저항성, permissive 유사 모드, 재부팅 없는 전체 정책 교체, 원자적 update, 기존 구성 요소 철회, 어느 시점에서든 가능한 audit가 최소 요구사항이었다.

당시 유일한 무결성 정책 메커니즘인 IMA는 요구사항을 모두 충족하지 못했다. IMA를 확장하는 방안은 기존 사용자에게 영향을 줄 수 있는 큰 코드 변경의 regression 위험과, 측정·attestation 정책을 로컬 무결성 집행 정책과 분리하는 편이 낫다는 이유로 폐기됐다. 이에 로컬 무결성 정책 집행만 담당하는 새 LSM인 IPE를 만들었다.

IPE 정책 최소 요구
번호요구사항
1정책 무결성 검증
2rollback 공격 저항
3permissive 유사 모드
4재부팅 없는 전체 update
5원자적 update
6이전 구성 요소 철회
7시점별 audit 가능

정책 자체와 배포 수명 주기에 필요한 조건이다.

The next step was to choose a *policy* to enforce the integrity mechanism.
The minimum requirements for the policy were:

  1. The policy itself must be integrity verified (preventing trivial
     attack against it).
  2. The policy itself must be resistant to rollback attacks.
  3. The policy enforcement must have a permissive-like mode.
  4. The policy must be able to be updated, in its entirety, without
     a reboot.
  5. Policy updates must be atomic.
  6. The policy must support *revocations* of previously authored
     components.
  7. The policy must be auditable, at any point-of-time.

IMA, as the only integrity policy mechanism at the time, was
considered against these list of requirements, and did not fulfill
all of the minimum requirements. Extending IMA to cover these
requirements was considered, but ultimately discarded for a
two reasons:

  1. Regression risk; many of these changes would result in
     dramatic code changes to IMA, which is already present in the
     kernel, and therefore might impact users.

  2. IMA was used in the system for measurement and attestation;
     separation of measurement policy from local integrity policy
     enforcement was considered favorable.

Due to these reasons, it was decided that a new LSM should be created,
whose responsibility would be only the local integrity policy enforcement.

IPE의 역할과 설계 원칙

106-142

IPE는 이름 그대로 무결성 정책을 집행하는 해결책이다. 무결성을 어떤 방식으로 제공해야 하는지는 강제하지 않으며, 시스템 관리자가 자신의 요구에 맞는 메커니즘과 보안 수준을 선택한다. 여러 무결성 제공자는 서로 다른 보장을 제공하고 IPE 정책은 이론적으로 모두를 표현할 수 있다.

IPE 자체에는 무결성을 보장하는 내장 메커니즘이 없다. 무결성 claim을 증명하는 메커니즘과 그 claim을 집행하는 정책은 독립적이다. 따라서 IPE는 무결성 제공자와 쉽게 통합되고 플랫폼 관리자와 시스템 관리자가 쉽게 사용할 수 있도록 설계됐다.

다른 운영체제와 환경의 기존 정책 체계를 조사하면서 사람이 읽을 수 없는 바이너리 중간 형식, 사용자 정의할 수 없는 단일 암묵적 기본 action, 위반 rule을 찾기 위한 수동 디버깅, 정책 작성에 필요한 과도한 시스템 지식이 문제로 확인됐다. IPE는 이 네 가지 함정을 피하려 한다.

IPE 책임 분리
DM-Verity·fs-verity 등 무결성 제공자무결성 claim 생성IPE 정책이 claim과 operation 평가명시적 action 집행

무결성 증명과 정책 집행은 서로 독립된 층이다.

Role and Scope
--------------

IPE, as its name implies, is fundamentally an integrity policy enforcement
solution; IPE does not mandate how integrity is provided, but instead
leaves that decision to the system administrator to set the security bar,
via the mechanisms that they select that suit their individual needs.
There are several different integrity solutions that provide a different
level of security guarantees; and IPE allows sysadmins to express policy for
theoretically all of them.

IPE does not have an inherent mechanism to ensure integrity on its own.
Instead, there are more effective layers available for building systems that
can guarantee integrity. It's important to note that the mechanism for proving
integrity is independent of the policy for enforcing that integrity claim.

Therefore, IPE was designed around:

  1. Easy integrations with integrity providers.
  2. Ease of use for platform administrators/sysadmins.

Design Rationale:
-----------------

IPE was designed after evaluating existing integrity policy solutions
in other operating systems and environments. In this survey of other
implementations, there were a few pitfalls identified:

  1. Policies were not readable by humans, usually requiring a binary
     intermediary format.
  2. A single, non-customizable action was implicitly taken as a default.
  3. Debugging the policy required manual steps to determine what rule was violated.
  4. Authoring a policy required an in-depth knowledge of the larger system,
     or operating system.

IPE attempts to avoid all of these pitfalls.

사람이 읽는 일반 텍스트 정책

143-188

IPE 정책은 일반 텍스트다. 다른 LSM보다 파일이 조금 커질 수 있지만 바이너리 정책에서 생기는 유지보수 중복과 투명성 문제를 해결한다. 정책 작성자는 XML·JSON·YAML 등 어떤 형태든 사람이 이해하는 문자열 표현으로 시작한다. 바이너리 설계라면 이를 바이너리로 만드는 serializer와 커널 구조체로 바꾸는 deserializer가 필요하다.

배포된 정책을 나중에 이해하려면 바이너리를 가능한 많은 정보와 함께 사람이 읽는 형식으로 되돌리는 또 다른 deserializer도 필요하다. 대규모 fleet에서는 여러 운영체제와 운용 요구에 따라 수년 전 stale policy가 남을 수 있으므로 checksum과 원본 파일을 별도 추적하거나 정책 복구 인프라를 운영해야 한다. 일반 텍스트를 직접 parse하면 사람이 읽는 형식에서 커널 구조체로 가는 serializer 하나만 유지하면 된다.

정책은 시스템 자원의 신뢰를 기준으로 접근을 통제하므로 정책 변경 자체도 신뢰할 수 있어야 하고 서명 과정이 필요하다. 서명 대상은 무결성 집행 체계를 공격하는 데 쓰일 수 있어 높은 보안 기준을 적용해야 한다. 바이너리 blob은 서명자가 내용을 보기 어렵지만 일반 텍스트 정책은 실제 규칙을 확인한 뒤 서명할 수 있어 투명하다.

정책 표현 비교
관점바이너리 정책IPE 일반 텍스트
변환 코드여러 serializer/deserializer커널 parser 하나
장기 추적checksum·원본 대응표 필요배포 내용을 직접 판독
서명 검토불투명 blob실제 규칙 확인 가능

일반 텍스트는 유지보수와 서명 검토를 단순화한다.

Policy
~~~~~~

Plain Text
^^^^^^^^^^

IPE's policy is plain-text. This introduces slightly larger policy files than
other LSMs, but solves two major problems that occurs with some integrity policy
solutions on other platforms.

The first issue is one of code maintenance and duplication. To author policies,
the policy has to be some form of string representation (be it structured,
through XML, JSON, YAML, etcetera), to allow the policy author to understand
what is being written. In a hypothetical binary policy design, a serializer
is necessary to write the policy from the human readable form, to the binary
form, and a deserializer is needed to interpret the binary form into a data
structure in the kernel.

Eventually, another deserializer will be needed to transform the binary from
back into the human-readable form with as much information preserved. This is because a
user of this access control system will have to keep a lookup table of a checksum
and the original file itself to try to understand what policies have been deployed
on this system and what policies have not. For a single user, this may be alright,
as old policies can be discarded almost immediately after the update takes hold.
For users that manage computer fleets in the thousands, if not hundreds of thousands,
with multiple different operating systems, and multiple different operational needs,
this quickly becomes an issue, as stale policies from years ago may be present,
quickly resulting in the need to recover the policy or fund extensive infrastructure
to track what each policy contains.

With now three separate serializer/deserializers, maintenance becomes costly. If the
policy avoids the binary format, there is only one required serializer: from the
human-readable form to the data structure in kernel, saving on code maintenance,
and retaining operability.

The second issue with a binary format is one of transparency. As IPE controls
access based on the trust of the system's resources, it's policy must also be
trusted to be changed. This is done through signatures, resulting in needing
signing as a process. Signing, as a process, is typically done with a
high security bar, as anything signed can be used to attack integrity
enforcement systems. It is also important that, when signing something, that
the signer is aware of what they are signing. A binary policy can cause
obfuscation of that fact; what signers see is an opaque binary blob. A
plain-text policy, on the other hand, the signers see the actual policy
submitted for signing.

부팅 정책과 initramfs 전환

189-233

적절히 설정된 IPE는 커널 부팅 뒤 usermode가 시작되자마자 정책을 집행할 수 있다. 시작 정책의 저장 방식은 디스크 파일을 커널이 집행 결정 전에 읽기, bootloader가 정책을 커널에 전달하기, 정책 파일을 커널에 빌드해 초기화 때 parse하기의 세 가지다.

커널이 사용자 공간의 파일을 직접 읽는 첫 방식은 권장되지 않고 드물다. 두 번째는 Linux가 지원하는 모든 bootloader가 새 전달 방식을 구현해야 하거나 별도 소스가 필요하며 커널 시작 절차를 필요 이상으로 크게 바꿀 수 있다. 세 번째가 가장 적합하지만 정책이 커널 이미지 공간을 차지한다. 또한 사용자 공간이 더 복잡한 새 정책을 올릴 수 있을 만큼 일반적이면서 과도한 권한을 주지 않을 만큼 제한적이어야 한다.

initramfs를 사용하면 이 전환을 구성할 수 있다. 커널은 initramfs만 신뢰하는 최소 정책으로 시작한다. initramfs 안에서 실제 rootfs를 mount하되 아직 전환하기 전에 새 rootfs를 신뢰하는 정책을 배포하고 활성화한다. 이 방식은 어느 단계에서도 과도한 권한을 주지 않고 빌드 내장 정책도 작게 유지한다.

모든 시스템이 initramfs로 시작하지는 않으므로 커널에 빌드된 시작 정책은 다음 부팅 단계의 신뢰 수립 방식을 표현할 유연성이 필요하다. 빌드 내장 정책을 완전한 IPE 정책으로 만들면 시스템 제작자가 첫 단계의 부팅 요구사항을 정확히 기술할 수 있다.

부팅 신뢰 전환
커널 내장 IPE 정책initramfs만 신뢰실제 rootfs mount새 rootfs 정책 배포·활성화rootfs로 전환

최소 내장 정책에서 실제 rootfs 정책으로 권한을 넓힌다.

Boot Policy
~~~~~~~~~~~

IPE, if configured appropriately, is able to enforce a policy as soon as a
kernel is booted and usermode starts. That implies some level of storage
of the policy to apply the minute usermode starts. Generally, that storage
can be handled in one of three ways:

  1. The policy file(s) live on disk and the kernel loads the policy prior
     to an code path that would result in an enforcement decision.
  2. The policy file(s) are passed by the bootloader to the kernel, who
     parses the policy.
  3. There is a policy file that is compiled into the kernel that is
     parsed and enforced on initialization.

The first option has problems: the kernel reading files from userspace
is typically discouraged and very uncommon in the kernel.

The second option also has problems: Linux supports a variety of bootloaders
across its entire ecosystem - every bootloader would have to support this
new methodology or there must be an independent source. It would likely
result in more drastic changes to the kernel startup than necessary.

The third option is the best but it's important to be aware that the policy
will take disk space against the kernel it's compiled in. It's important to
keep this policy generalized enough that userspace can load a new, more
complicated policy, but restrictive enough that it will not overauthorize
and cause security issues.

The initramfs provides a way that this bootup path can be established. The
kernel starts with a minimal policy, that trusts the initramfs only. Inside
the initramfs, when the real rootfs is mounted, but not yet transferred to,
it deploys and activates a policy that trusts the new root filesystem.
This prevents overauthorization at any step, and keeps the kernel policy
to a minimal size.

Startup
^^^^^^^

Not every system, however starts with an initramfs, so the startup policy
compiled into the kernel will need some flexibility to express how trust
is established for the next phase of the bootup. To this end, if we just
make the compiled-in policy a full IPE policy, it allows system builders
to express the first stage bootup requirements appropriately.

재부팅 없는 전체 정책 교체와 서명

234-256

기존 신뢰 애플리케이션의 취약점 발견이나 키 교체처럼 요구사항은 변한다. 보안 목표만을 위해 커널을 갱신하는 것은 항상 적절하거나 무위험하지 않고, 보안 update를 막으면 시스템이 취약해진다. 따라서 IPE 정책은 기존 정책을 철회할 수 있도록 전체를 교체할 수 있어야 하고, 커널 외부에서 공급해 커널 update 없이 갱신할 수 있어야 한다.

커널은 부팅 간 상태를 보존하지 않고 커널 공간에서 디스크 정책 파일을 읽는 것도 바람직하지 않으므로 update는 재부팅 없이 이뤄져야 한다. 외부 소스는 악의적일 수 있어 정책이 신뢰됨을 식별해야 한다. IPE는 커널의 신뢰 원천으로 이어지는 서명을 사용하며, 기본 신뢰 원천은 빌드 시 채워지는 `SYSTEM_TRUSTED_KEYRING`이다. 이는 빌드 내장 정책 작성자와 update 배포 주체가 같다는 기대에 맞는다.

외부 정책 update 신뢰
커널 외부의 새 전체 정책정책 서명 검증SYSTEM_TRUSTED_KEYRING 신뢰 연결원자적 활성 정책 교체

외부 정책은 커널 키링으로 이어지는 서명 체인을 통과해야 한다.

Updatable, Rebootless Policy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As requirements change over time (vulnerabilities are found in previously
trusted applications, keys roll, etcetera). Updating a kernel to change the
meet those security goals is not always a suitable option, as updates are not
always risk-free, and blocking a security update leaves systems vulnerable.
This means IPE requires a policy that can be completely updated (allowing
revocations of existing policy) from a source external to the kernel (allowing
policies to be updated without updating the kernel).

Additionally, since the kernel is stateless between invocations, and reading
policy files off the disk from kernel space is a bad idea(tm), then the
policy updates have to be done rebootlessly.

To allow an update from an external source, it could be potentially malicious,
so this policy needs to have a way to be identified as trusted. This is
done via a signature chained to a trust source in the kernel. Arbitrarily,
this is  the ``SYSTEM_TRUSTED_KEYRING``, a keyring that is initially
populated at kernel compile-time, as this matches the expectation that the
author of the compiled-in policy described above is the same entity that can
deploy policy updates.

policy_version과 재부팅 경계

257-280

시간이 지나면 취약점이 발견되어 기존 자원을 더 이상 신뢰할 수 없고, 잘못 작성한 안전하지 않은 정책을 배포했다가 수정할 수도 있다. 공격자가 서명된 취약 정책을 확보했다면 안전한 update 이후 그 정책으로 되돌리는 rollback을 막아야 한다.

IPE 정책의 `policy_version`은 시스템에서 활성화할 수 있는 모든 정책의 최소 버전을 나타내며 실행 중 rollback을 막는다. 그러나 커널은 부팅 간 상태를 보존하지 않으므로 다음 부팅에서는 정책 버전이 `0.0.0`으로 초기화된다. 시스템 제작자는 부팅 직후 새 안전 정책을 가능한 빨리 배포해 공격자가 취약 정책을 올릴 수 있는 시간 창을 최소화해야 한다.

Rollback 보호 범위
시점상태필요 조치
현재 부팅최소 policy_version 유지낮은 버전 거부
다음 부팅0.0.0으로 초기화안전 정책을 즉시 재배포

policy_version은 실행 중에는 유효하지만 재부팅 경계를 넘지 않는다.

Anti-Rollback / Anti-Replay
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Over time, vulnerabilities are found and trusted resources may not be
trusted anymore. IPE's policy has no exception to this. There can be
instances where a mistaken policy author deploys an insecure policy,
before correcting it with a secure policy.

Assuming that as soon as the insecure policy is signed, and an attacker
acquires the insecure policy, IPE needs a way to prevent rollback
from the secure policy update to the insecure policy update.

Initially, IPE's policy can have a policy_version that states the
minimum required version across all policies that can be active on
the system. This will prevent rollback while the system is live.

.. WARNING::

  However, since the kernel is stateless across boots, this policy
  version will be reset to 0.0.0 on the next boot. System builders
  need to be aware of this, and ensure the new secure policies are
  deployed ASAP after a boot to ensure that the window of
  opportunity is minimal for an attacker to deploy the insecure policy.

operation별 명시적 DEFAULT action

281-342

암묵적 action의 문제는 시스템 안의 여러 operation에 서로 다른 보안 기준을 적용할 때 드러난다. 실행 코드는 예외 없이 강한 무결성을 요구하지만 중요한 특정 데이터 파일만 보호하고 일반 로그 쓰기·읽기는 허용할 수 있다. rule 불일치 시 항상 DENY, 항상 ALLOW, 정책 작성자가 operation별 기본 action을 지정하는 세 모델이 가능하다.

불일치를 DENY하는 첫 모델에서 `op=EXECUTE integrity_verified=YES action=ALLOW`는 실행 보호에 잘 맞는다. 그러나 데이터 read에는 중요 레이블의 검증 실패를 DENY하고 나머지를 ALLOW하는 마지막 빈 규칙이 필요해 실질적으로 기본값을 바꾼다. 불일치를 ALLOW하는 두 번째 모델은 중요 데이터 read 규칙은 간단하지만 실행에서는 검증 성공을 ALLOW한 뒤 나머지를 DENY하는 빈 규칙이 필요하다.

IPE는 세 번째 모델을 택해 사용자가 각 operation의 기본값을 명시하도록 강제한다. 예제는 `DEFAULT op=EXECUTE action=DENY` 뒤 검증된 실행만 ALLOW하고, `DEFAULT op=READ action=ALLOW` 뒤 `critical_t` 레이블에서 검증되지 않은 read만 DENY한다. 규칙은 작성 순서대로 평가된다.

암묵적 action 모델
모델장점문제
불일치 DENY실행 보호에 자연스러움일반 read 허용용 빈 규칙 필요
불일치 ALLOW선택적 데이터 보호에 단순미검증 실행 차단용 빈 규칙 필요
명시적 DEFAULToperation별 의도 공개작성자가 기본값을 반드시 결정

operation마다 다른 보안 수준을 표현할 때의 차이다.

IPE 규칙 평가
요청 operation 식별정책 줄을 순서대로 평가첫 일치 rule의 action 사용구체 rule이 없으면 해당 operation의 DEFAULT 사용

operation별 DEFAULT와 구체 rule을 작성 순서대로 평가한다.

Implicit Actions:
~~~~~~~~~~~~~~~~~

The issue of implicit actions only becomes visible when you consider
a mixed level of security bars across multiple operations in a system.
For example, consider a system that has strong integrity guarantees
over both the executable code, and specific *data files* on the system,
that were critical to its function. In this system, three types of policies
are possible:

  1. A policy in which failure to match any rules in the policy results
     in the action being denied.
  2. A policy in which failure to match any rules in the policy results
     in the action being allowed.
  3. A policy in which the action taken when no rules are matched is
     specified by the policy author.

The first option could make a policy like this::

  op=EXECUTE integrity_verified=YES action=ALLOW

In the example system, this works well for the executables, as all
executables should have integrity guarantees, without exception. The
issue becomes with the second requirement about specific data files.
This would result in a policy like this (assuming each line is
evaluated in order)::

  op=EXECUTE integrity_verified=YES action=ALLOW

  op=READ integrity_verified=NO label=critical_t action=DENY
  op=READ action=ALLOW

This is somewhat clear if you read the docs, understand the policy
is executed in order and that the default is a denial; however, the
last line effectively changes that default to an ALLOW. This is
required, because in a realistic system, there are some unverified
reads (imagine appending to a log file).

The second option, matching no rules results in an allow, is clearer
for the specific data files::

  op=READ integrity_verified=NO label=critical_t action=DENY

And, like the first option, falls short with the execution scenario,
effectively needing to override the default::

  op=EXECUTE integrity_verified=YES action=ALLOW
  op=EXECUTE action=DENY

  op=READ integrity_verified=NO label=critical_t action=DENY

This leaves the third option. Instead of making users be clever
and override the default with an empty rule, force the end-user
to consider what the appropriate default should be for their
scenario and explicitly state it::

  DEFAULT op=EXECUTE action=DENY
  op=EXECUTE integrity_verified=YES action=ALLOW

  DEFAULT op=READ action=ALLOW
  op=READ integrity_verified=NO label=critical_t action=DENY

일치한 규칙을 직접 audit

343-366

정책 개발에서는 어떤 줄이 위반됐는지 알아야 조사 범위를 줄일 수 있다. 일부 체계는 평가 입력만 기록해 사용자가 정책과 다시 대조해야 하지만, IPE는 실제로 일치한 rule을 내보낸다. 구체 rule이면 정확한 정책 줄, `DEFAULT`면 해당 section까지 범위를 좁혀 반복 수정과 조사 시간을 줄인다.

정책 엔진은 사람이 실패 과정을 재현하기 쉽게 설계됐다. 각 줄을 작성 순서대로 평가하므로 알고리즘이 단순하다. load 때 rule을 정렬하는 등 최적화하는 체계는 디버깅 단계가 늘고 코드를 읽기 전에는 실제 순서가 분명하지 않을 수 있지만 IPE는 원문 순서를 유지한다.

Policy Debugging:
~~~~~~~~~~~~~~~~~

When developing a policy, it is useful to know what line of the policy
is being violated to reduce debugging costs; narrowing the scope of the
investigation to the exact line that resulted in the action. Some integrity
policy systems do not provide this information, instead providing the
information that was used in the evaluation. This then requires a correlation
with the policy to evaluate what went wrong.

Instead, IPE just emits the rule that was matched. This limits the scope
of the investigation to the exact policy line (in the case of a specific
rule), or the section (in the case of a DEFAULT). This decreases iteration
and investigation times when policy failures are observed while evaluating
policies.

IPE's policy engine is also designed in a way that it makes it obvious to
a human of how to investigate a policy failure. Each line is evaluated in
the sequence that is written, so the algorithm is very simple to follow
for humans to recreate the steps and could have caused the failure. In other
surveyed systems, optimizations occur (sorting rules, for instance) when loading
the policy. In those systems, it requires multiple steps to debug, and the
algorithm may not always be clear to the end-user without reading the code first.

syscall 대신 operation 중심 정책

367-378

IPE 정책의 대상은 커널 개발자가 아니라 시스템 관리자다. 개별 LSM hook이나 syscall 대신 상위 수준 operation을 다룬다. 관리자는 `mmap`, `mprotect`, `execve`, `uselib` 각각을 알아야 하는 대신 code execution을 제한한다는 요구만 표현하면 된다. 이로써 내부 지식 부족으로 생기는 우회를 줄이고, 어떤 hook이 어떤 조건에서 operation으로 매핑되는지는 IPE 유지관리자가 책임진다.

정책 추상화
mmap / mprotect / execve / uselibIPE 유지관리자의 hook 매핑EXECUTE operation관리자의 단일 정책 규칙

여러 커널 진입점을 하나의 관리 목적 operation으로 묶는다.

Simplified Policy:
~~~~~~~~~~~~~~~~~~

Finally, IPE's policy is designed for sysadmins, not kernel developers. Instead
of covering individual LSM hooks (or syscalls), IPE covers operations. This means
instead of sysadmins needing to know that the syscalls ``mmap``, ``mprotect``,
``execve``, and ``uselib`` must have rules protecting them, they must simple know
that they want to restrict code execution. This limits the amount of bypasses that
could occur due to a lack of knowledge of the underlying system; whereas the
maintainers of IPE, being kernel developers can make the correct choice to determine
whether something maps to these operations, and under what conditions.

익명 메모리와 파일 없는 입력

379-397

IPE는 익명 메모리를 다른 접근과 별도로 취급하지 않는다. 익명 메모리에 `+X`를 부여하면 `file_mmap` 또는 `file_mprotect` hook으로 들어오지만 파일 객체는 `NULL`이다. 이 요청도 다른 파일처럼 평가되지만 현재 trust property는 모두 파일 기반이므로 파일과 연결되지 않은 operation에서는 모두 false가 된다.

`kernel_load_data` hook에서 커널이 파일로 뒷받침되지 않는 사용자 공간 버퍼의 데이터를 load할 때도 같은 일이 발생한다. 이 경우에도 현재 trust property는 모두 false로 평가된다.

파일 없는 평가
경로file 객체trust property
익명 +X mmap/mprotectNULL모두 false
사용자 버퍼 kernel_load_data파일 backing 없음모두 false

파일 객체가 없으면 파일 기반 trust property를 만족할 수 없다.

Implementation Notes
--------------------

Anonymous Memory
~~~~~~~~~~~~~~~~

Anonymous memory isn't treated any differently from any other access in IPE.
When anonymous memory is mapped with ``+X``, it still comes into the ``file_mmap``
or ``file_mprotect`` hook, but with a ``NULL`` file object. This is submitted to
the evaluation, like any other file. However, all current trust properties will
evaluate to false, as they are all file-based and the operation is not
associated with a file.

.. WARNING::

  This also occurs with the ``kernel_load_data`` hook, when the kernel is
  loading data from a userspace buffer that is not backed by a file. In this
  scenario all current trust properties will also evaluate to false.

정책별 securityfs 트리

398-414

IPE의 정책별 `securityfs` 트리는 일반적인 정책 트리와 조금 다르다. `MyPolicy` 디렉터리 아래에는 `active`, `delete`, `name`, `pkcs7`, `policy`, `update`, `version` 항목이 있다. 정책 객체는 `MyPolicy` inode의 `->i_private` 데이터에 저장된다.

MyPolicy securityfs 항목
항목용도 범주
active활성 상태
delete정책 제거
name / version식별 정보
pkcs7정책 서명
policy정책 내용
update정책 갱신

정책 상태·내용·서명·갱신을 노출하는 노드다.

Securityfs Interface
~~~~~~~~~~~~~~~~~~~~

The per-policy securityfs tree is somewhat unique. For example, for
a standard securityfs policy tree::

  MyPolicy
    |- active
    |- delete
    |- name
    |- pkcs7
    |- policy
    |- update
    |- version

The policy is stored in the ``->i_private`` data of the MyPolicy inode.

KUnit과 통합 테스트

415-446

IPE에는 정책 parser용 KUnit 테스트가 있다. 권장 `kunitconfig`는 KUnit, Security, securityfs, PKCS#7 parser, system data verification, fs-verity와 내장 서명, block·device mapper·dm-verity와 root hash 서명 검증, networking, audit와 audit syscall, initrd를 활성화한다.

IPE 자체 설정으로 `CONFIG_SECURITY_IPE`, DM-Verity·DM-Verity 서명·fs-verity·fs-verity 내장 서명 trust property와 `CONFIG_SECURITY_IPE_KUNIT_TEST`를 활성화한다. 원문의 전체 `CONFIG_*` 목록과 값은 그대로 보존된다.

추가로 IPE에는 Python 기반 통합 테스트 모음 `https://github.com/microsoft/ipe/tree/test-suite`가 있으며 사용자 인터페이스와 실제 정책 집행 기능을 함께 검사할 수 있다.

IPE 테스트 층
대상
KUnit정책 parser와 trust property 구성
Python integration suite사용자 인터페이스와 enforcement

parser 단위 테스트와 사용자 인터페이스·집행 통합 테스트를 함께 사용한다.

Tests
-----

IPE has KUnit Tests for the policy parser. Recommended kunitconfig::

  CONFIG_KUNIT=y
  CONFIG_SECURITY=y
  CONFIG_SECURITYFS=y
  CONFIG_PKCS7_MESSAGE_PARSER=y
  CONFIG_SYSTEM_DATA_VERIFICATION=y
  CONFIG_FS_VERITY=y
  CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
  CONFIG_BLOCK=y
  CONFIG_MD=y
  CONFIG_BLK_DEV_DM=y
  CONFIG_DM_VERITY=y
  CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
  CONFIG_NET=y
  CONFIG_AUDIT=y
  CONFIG_AUDITSYSCALL=y
  CONFIG_BLK_DEV_INITRD=y

  CONFIG_SECURITY_IPE=y
  CONFIG_IPE_PROP_DM_VERITY=y
  CONFIG_IPE_PROP_DM_VERITY_SIGNATURE=y
  CONFIG_IPE_PROP_FS_VERITY=y
  CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG=y
  CONFIG_SECURITY_IPE_KUNIT_TEST=y

In addition, IPE has a python based integration
`test suite <https://github.com/microsoft/ipe/tree/test-suite>`_ that
can test both user interfaces and enforcement functionalities.