@@ -221,12 +221,12 @@ such as Hypercall APIs, I/O emulations, and EPT violation handling.
221
221
The main security goal of the ACRN hypervisor design is to prevent
222
222
Privilege Escalation and enforce Isolation, for example:
223
223
224
- - VMM privilege escalation (vmx non-root -> vmx root)
224
+ - VMM privilege escalation (VMX non-root -> VMX root)
225
225
- Non-secure OS software (running in AaaG) accessing secure world TEE
226
226
assets
227
227
- Unauthorized software from executing in the hypervisor
228
228
- Cross-guest VM attacks
229
- - Hypervisor secret information leaks
229
+ - Hypervisor secret information leakage
230
230
231
231
Memory Management Enhancement
232
232
-----------------------------
@@ -257,9 +257,9 @@ boundary for memory space between the hypervisor and Guest VMs.
257
257
258
258
Hypervisor and Guest Memory Layout
259
259
260
- The hypervisor must appropriately configure the EPT tables (GPA->HPA
261
- mapping) to disallow any guest to access (read/write/execution) the
262
- memory space owned by the hypervisor.
260
+ The hypervisor must appropriately configure the EPT tables to disallow
261
+ any guest to access (read/write/execution) the memory space owned by
262
+ the hypervisor.
263
263
264
264
Memory Access Restrictions
265
265
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -395,16 +395,13 @@ In order to activate SMEP protection, ACRN hypervisor must:
395
395
#. Set CR4.SMEP bit. In the entire lifecycle of the hypervisor, this bit
396
396
value always remains one.
397
397
398
- As an alternative, NX feature can also be used for this purpose by
399
- setting the corresponding NX (non-execution) bit for all the guest
400
- memory mapping in host CR3 paging tables.
398
+ As an alternative, NX feature is used for this purpose by setting the
399
+ corresponding NX (non-execution) bit for all the guest memory mapping
400
+ in host CR3 paging tables.
401
401
402
402
Since hypervisor code never runs in Ring 3 mode, either of these two
403
- solutions works very well. As the NX bit is also used by the hypervisor
404
- to disable execution of its own data (by policies mentioned previously),
405
- the latter solution should be easier to implement. Since enabling
406
- CR0.SMEP bit is simple and does no harm to the system, it is recommended
407
- that both solutions should be enabled in the ACRN hypervisor.
403
+ solutions works very well. Both solutions are enabled in the ACRN
404
+ hypervisor.
408
405
409
406
Guest Memory Access Prevention
410
407
++++++++++++++++++++++++++++++
@@ -416,7 +413,7 @@ application program.
416
413
417
414
This feature is controlled by the CR4.SMAP bit. When that bit is set,
418
415
any attempt to access user-accessible memory pages while running in a
419
- privileged or kernel mode will lead to a page fault.
416
+ privileged or kernel mode will lead to a page fault.
420
417
421
418
However, there are times when the kernel legitimately needs to work with
422
419
user-accessible memory pages. The Intel processor defines a separate
@@ -429,14 +426,11 @@ To manipulate that flag relatively quickly, STAC (set AC flag) and CLAC
429
426
(clear AC flag) instructions are introduced for this purpose. Note that
430
427
STAC and CLAC can only be executed in kernel mode (CPL=0).
431
428
432
- To activate SMAP protection, ACRN hypervisor must :
429
+ To activate SMAP protection in ACRN hypervisor:
433
430
434
431
#. Configure all the guest memory as user-writable memory (U/S bit = 1,
435
432
and R/W bit = 1) in corresponding host CR3 paging table entries, as
436
- shown in :numref: `security-smap ` below. Note that the R/W bit would also be clear,
437
- which means that the corresponding user-accessible pages are
438
- read-only to user mode. Then if CR0.WP = 1, even the kernel mode (in
439
- hypervisor ring 0) cannot even write to this user-accessible pages.
433
+ shown in :numref: `security-smap ` below.
440
434
#. Set CR4.SMAP bit. In the entire lifecycle of hypervisor, this bit
441
435
value always remains one.
442
436
#. When needed, use STAC instruction to suppress SMAP protection, and
@@ -470,29 +464,13 @@ The attack surface can be minimized because there is only a
470
464
very small window between step 1 and step 3 in which the guest memory
471
465
can be accessed by hypervisor code running in ring 0.
472
466
473
- The following section details the memory operation rules and
474
- functions when accessing guest memory pages.
475
-
476
- Memory Operation Functions/Rules for Accessing Guest Memory
477
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
478
-
479
- The Linux kernel uses copy\_ [to/from]\_ user() / get\_ user() /
480
- put\_ user() whenever the kernel legitimately attempts to access
481
- user-accessible memory pages (refer to `Linux kernel copy routines
482
- documentation
483
- <https://www.kernel.org/doc/htmldocs/kernel-hacking/routines-copy.html> `_
484
- The ACRN hypervisor, provides similar functions:
485
-
486
- ``put_vm() ``, and ``get_vm() ``
487
- used to put and get single values (such as an int, char, or long) to
488
- and from vm / guest memory area (user-accessible pages).
489
-
490
- ``copy\_to\_vm() ``, and ``copy\_from\_vm() ``
491
- used to copy an arbitrary amount of data to and from vm / guest
492
- memory area (user-accessible pages).
467
+ Rules to Access Guest Memory in Hypervisor
468
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
493
469
494
- Inside these functions, the internal memory read/write operations
495
- are surrounded by STAC and CLAC instructions.
470
+ In ACRN hypervisor, functions ``stac() `` and ``clac() `` wrap
471
+ STAC and CLAC instructions respectively, and functions
472
+ ``copy_to_gpa() ``, and ``copy_from_gpa() `` can be used to copy
473
+ an arbitrary amount of data to or from VM memory area.
496
474
497
475
Whenever the hypervisor needs to perform legitimate read/write access to
498
476
guest memory pages, one of functions above must be used. Otherwise, the
@@ -506,8 +484,8 @@ host MMU mapping), and must not be in the range of hypervisor memory.
506
484
Details of these ordinary checks are out of scope in this document.
507
485
508
486
509
- Memory Information Leak
510
- -----------------------
487
+ Avoidance of Memory Information Leakage
488
+ ---------------------------------------
511
489
512
490
Protecting the hypervisor's memory is critical to the security of the
513
491
entire platform. The hypervisor must prevent any memory content (e.g.
0 commit comments