2018-11-03 02:35:17 +08:00
|
|
|
.. _l1tf:
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
L1 Terminal Fault Mitigation
|
|
|
|
############################
|
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
|
|
|
|
Refer to `Intel Analysis of L1TF`_ and `Linux L1TF document`_ for details.
|
|
|
|
|
|
|
|
.. _Intel Analysis of L1TF:
|
|
|
|
https://software.intel.com/security-software-guidance/insights/deep-dive-intel-analysis-l1-terminal-fault
|
|
|
|
|
|
|
|
.. _Linux L1TF document:
|
2020-03-19 04:32:45 +08:00
|
|
|
https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/l1tf.html
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2020-10-03 06:24:32 +08:00
|
|
|
L1 Terminal Fault is a speculative side channel that allows unprivileged
|
|
|
|
speculative access to data that is available in the Level 1 Data Cache
|
|
|
|
when the page table entry controlling the virtual address, used
|
|
|
|
for the access, has the present bit cleared or reserved bits set.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2020-04-11 01:44:30 +08:00
|
|
|
When the processor accesses a linear address, it first looks for a
|
2018-11-03 02:35:17 +08:00
|
|
|
translation to a physical address in the translation lookaside buffer (TLB).
|
2018-11-03 02:39:35 +08:00
|
|
|
For an unmapped address this will not provide a physical address, so the
|
|
|
|
processor performs a table walk of a hierarchical paging structure in
|
|
|
|
memory that provides translations from linear to physical addresses. A page
|
2018-11-03 02:35:17 +08:00
|
|
|
fault is signaled if this table walk fails.
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
During the process of a terminal fault, the processor speculatively computes
|
|
|
|
a physical address from the paging structure entry and the address of the
|
|
|
|
fault. This physical address is composed of the address of the page frame
|
|
|
|
and low order bits from the linear address. If data with this physical
|
|
|
|
address is present in the L1D, that data may be loaded and forwarded to
|
|
|
|
dependent instructions. These dependent instructions may create a side
|
2018-11-03 02:35:17 +08:00
|
|
|
channel.
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Because the resulting probed physical address is not a true translation of
|
|
|
|
the virtual address, the resulting address is not constrained by various
|
2018-11-03 02:35:17 +08:00
|
|
|
memory range checks or nested translations. Specifically:
|
|
|
|
|
2019-03-09 03:01:04 +08:00
|
|
|
* Intel |reg| SGX protected memory checks are not applied.
|
2018-11-03 02:39:35 +08:00
|
|
|
* Extended Page Table (EPT) guest physical to host physical address
|
2018-11-03 02:35:17 +08:00
|
|
|
translation is not applied.
|
|
|
|
* SMM protected memory checks are not applied.
|
|
|
|
|
|
|
|
The following CVE entries are related to the L1TF:
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
============= ================= ==============================
|
2019-03-09 03:01:04 +08:00
|
|
|
CVE-2018-3615 L1 Terminal Fault Intel SGX related aspects
|
2018-11-03 02:39:35 +08:00
|
|
|
CVE-2018-3620 L1 Terminal Fault OS, SMM related aspects
|
|
|
|
CVE-2018-3646 L1 Terminal Fault Virtualization related aspects
|
|
|
|
============= ================= ==============================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
L1TF Problem in ACRN
|
2018-11-03 02:39:35 +08:00
|
|
|
********************
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
There are mainly three attack scenarios considered in ACRN:
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
- Guest -> hypervisor attack
|
|
|
|
- Guest -> guest attack
|
|
|
|
- Normal_world -> secure_world attack (Android specific)
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
Malicious user space is not a concern to ACRN hypervisor, because
|
2018-12-06 08:54:36 +08:00
|
|
|
every guest runs in VMX non-root. It is responsibility of guest kernel
|
2018-11-03 02:35:17 +08:00
|
|
|
to protect itself from malicious user space attack.
|
|
|
|
|
2019-03-09 03:01:04 +08:00
|
|
|
Intel SGX/SMM related attacks are mitigated by using latest microcode.
|
2018-11-03 02:39:35 +08:00
|
|
|
There is no additional action in ACRN hypervisor.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Guest -> hypervisor Attack
|
|
|
|
==========================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2020-04-11 01:44:30 +08:00
|
|
|
ACRN always enables EPT for all guests (Service VM and User VM), thus a malicious
|
2018-11-03 02:39:35 +08:00
|
|
|
guest can directly control guest PTEs to construct L1TF-based attack
|
|
|
|
to hypervisor. Alternatively if ACRN EPT is not sanitized with some
|
2018-11-03 02:35:17 +08:00
|
|
|
PTEs (with present bit cleared, or reserved bit set) pointing to valid
|
2018-11-03 02:39:35 +08:00
|
|
|
host PFNs, a malicious guest may use those EPT PTEs to construct an attack.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
A special aspect of L1TF in the context of virtualization is symmetric
|
2020-10-03 06:24:32 +08:00
|
|
|
multithreading (SMT), e.g. Intel |reg| Hyper-threading Technology.
|
2018-11-03 02:35:17 +08:00
|
|
|
Logical processors on the affected physical cores share the L1 Data Cache
|
|
|
|
(L1D). This fact could make more variants of L1TF-based attack, e.g.
|
|
|
|
a malicious guest running on one logical processor can attack the data which
|
|
|
|
is brought into L1D by the context which runs on the sibling thread of
|
|
|
|
the same physical core. This context can be any code in hypervisor.
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Guest -> guest Attack
|
|
|
|
=====================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
The possibility of guest -> guest attack varies on specific configuration,
|
2020-09-26 07:24:35 +08:00
|
|
|
e.g. whether CPU partitioning is used, whether Hyper-threading is on, etc.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
If CPU partitioning is enabled (default policy in ACRN), there is
|
2018-11-03 02:39:35 +08:00
|
|
|
1:1 mapping between vCPUs and pCPUs i.e. no sharing of pCPU. There
|
2020-09-26 07:24:35 +08:00
|
|
|
may be an attack possibility when Hyper-threading is on, where
|
2020-10-03 06:24:32 +08:00
|
|
|
logical processors of the same physical core may be allocated to two
|
2018-11-03 02:39:35 +08:00
|
|
|
different guests. Then one guest may be able to attack the other guest
|
2018-11-03 02:35:17 +08:00
|
|
|
on sibling thread due to shared L1D.
|
|
|
|
|
|
|
|
If CPU sharing is enabled (not supported now), two VMs may share
|
|
|
|
same pCPU thus next VM may steal information in L1D which comes
|
2018-11-03 02:39:35 +08:00
|
|
|
from activity of previous VM on the same pCPU.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Normal_world -> Secure_world Attack
|
|
|
|
===================================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
ACRN supports Android guest, which requires two running worlds
|
|
|
|
(normal world and secure world). Two worlds run on the same CPU,
|
|
|
|
and world switch is conducted on demand. It could be possible for
|
|
|
|
normal world to construct an L1TF-based stack to secure world,
|
|
|
|
breaking the security model as expected by Android guest.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
Affected Processors
|
2018-11-03 02:39:35 +08:00
|
|
|
===================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2019-03-09 03:01:04 +08:00
|
|
|
L1TF affects a range of Intel processors, but Intel Atom |reg| processors
|
2018-11-03 02:39:35 +08:00
|
|
|
(including Apollo Lake) are immune to it. Currently ACRN hypervisor
|
|
|
|
supports only Apollo Lake. Support for other core-based platforms is
|
|
|
|
planned, so we still need a mitigation plan in ACRN.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Processors that have the RDCL_NO bit set to one (1) in the
|
|
|
|
IA32_ARCH_CAPABILITIES MSR are not susceptible to the L1TF
|
|
|
|
speculative execution side channel.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
Please refer to `Intel Analysis of L1TF`_ for more details.
|
|
|
|
|
|
|
|
L1TF Mitigation in ACRN
|
2018-11-03 02:39:35 +08:00
|
|
|
***********************
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2019-03-09 03:01:04 +08:00
|
|
|
Use the latest microcode, which mitigates SMM and Intel SGX cases
|
2018-11-03 02:39:35 +08:00
|
|
|
while also providing necessary capability for VMM to use for further
|
|
|
|
mitigation.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
ACRN will check the platform capability based on `CPUID enumeration
|
2018-11-03 02:39:35 +08:00
|
|
|
and architectural MSR`_. For L1TF affected platform (CPUID.07H.EDX.29
|
2018-11-03 02:35:17 +08:00
|
|
|
with MSR_IA32_ARCH_CAPABILITIES), L1D_FLUSH capability(CPUID.07H.EDX.28)
|
|
|
|
must be supported.
|
|
|
|
|
|
|
|
.. _CPUID enumeration and architectural MSR:
|
|
|
|
https://software.intel.com/security-software-guidance/insights/deep-dive-cpuid-enumeration-and-architectural-msrs
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Not all of mitigations below will be implemented in ACRN, and
|
|
|
|
not all of them apply to a specific ACRN deployment. Check the
|
|
|
|
'Mitigation Status'_ and 'Mitigation Recommendations'_ sections
|
|
|
|
for guidance.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
L1D flush on VMENTRY
|
2018-11-03 02:39:35 +08:00
|
|
|
====================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
ACRN may optionally flush L1D at VMENTRY, which ensures no
|
|
|
|
sensitive information from hypervisor or previous VM revealed
|
|
|
|
to current VM (in case of CPU sharing).
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
Flushing the L1D evicts not only the data which should not be
|
|
|
|
accessed by a potentially malicious guest, it also flushes the
|
2020-04-11 01:44:30 +08:00
|
|
|
guest data. Flushing the L1D has a performance impact as the
|
2018-11-03 02:35:17 +08:00
|
|
|
processor has to bring the flushed guest data back into the L1D,
|
|
|
|
and actual overhead is proportional to the frequency of vmentry.
|
|
|
|
|
|
|
|
Due to such performance reason, ACRN provides a config option
|
|
|
|
(L1D_FLUSH_VMENTRY) to enable/disable L1D flush during
|
|
|
|
VMENTRY. By default this option is disabled.
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
EPT Sanitization
|
|
|
|
================
|
|
|
|
|
|
|
|
EPT is sanitized to avoid pointing to valid host memory in PTEs
|
|
|
|
which has present bit cleared or reserved bits set.
|
|
|
|
|
2020-10-03 06:24:32 +08:00
|
|
|
For non-present PTEs, ACRN currently set PFN bits to ZERO, which
|
2018-11-03 02:39:35 +08:00
|
|
|
means page ZERO might fall into risk if containing security info.
|
|
|
|
ACRN reserves page ZERO (0~4K) from page allocator thus page ZERO
|
|
|
|
won't be used by anybody for valid usage. This sanitization logic
|
|
|
|
is always enabled on all platforms.
|
|
|
|
|
|
|
|
ACRN hypervisor doesn't set reserved bits in any EPT entry.
|
|
|
|
|
2018-11-03 02:35:17 +08:00
|
|
|
Put Secret Data into Uncached Memory
|
2018-11-03 02:39:35 +08:00
|
|
|
====================================
|
|
|
|
|
|
|
|
It is hard to decide which data in ACRN hypervisor is secret or valuable
|
|
|
|
data. The amount of valuable data from ACRN contexts cannot be declared as
|
|
|
|
non-interesting for an attacker without deep inspection of the code.
|
|
|
|
|
|
|
|
But obviously, the most import secret data in ACRN is the physical platform
|
|
|
|
seed generated from CSME and virtual seeds which are derived from that
|
|
|
|
platform seed. They are critical secrets to serve for guest keystore or
|
|
|
|
other security usage, e.g. disk encryption, secure storage.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
If the critical secret data in ACRN is identified, then such
|
2020-04-11 01:44:30 +08:00
|
|
|
data can be put into un-cached memory. As the content will
|
2020-10-03 06:24:32 +08:00
|
|
|
never go to L1D, it is immune to L1TF attack.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
For example, after getting the physical seed from CSME, before any guest
|
2018-11-03 02:39:35 +08:00
|
|
|
starts, ACRN can pre-derive all the virtual seeds for all the
|
|
|
|
guests and then put these virtual seeds into uncached memory,
|
2018-11-03 02:35:17 +08:00
|
|
|
at the same time flush & erase physical seed.
|
|
|
|
|
|
|
|
If all security data are identified and put in uncached
|
2018-12-06 08:54:36 +08:00
|
|
|
memory in a specific deployment, then it is not necessary to
|
2018-11-03 02:39:35 +08:00
|
|
|
prevent guest -> hypervisor attack, since there is nothing
|
2018-11-03 02:35:17 +08:00
|
|
|
useful to be attacked.
|
|
|
|
|
|
|
|
However if such 100% identification is not possible, user should
|
2018-11-03 02:39:35 +08:00
|
|
|
consider other mitigation options to protect hypervisor.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
L1D flush on World Switch
|
2018-11-03 02:39:35 +08:00
|
|
|
=========================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
For L1D-affected platforms, ACRN writes to aforementioned MSR
|
|
|
|
to flush L1D when switching from secure world to normal world.
|
|
|
|
Doing so guarantees no sensitive information from secure world
|
2018-11-03 02:39:35 +08:00
|
|
|
leaked in L1D. Performance impact is expected to small since world
|
2018-11-03 02:35:17 +08:00
|
|
|
switch frequency is not expected high.
|
|
|
|
|
|
|
|
It's not necessary to flush L1D in the other direction, since
|
|
|
|
normal world is less privileged entity to secure world.
|
|
|
|
|
|
|
|
This mitigation is always enabled.
|
|
|
|
|
|
|
|
Core-based scheduling
|
2018-11-03 02:39:35 +08:00
|
|
|
=====================
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2020-09-26 07:24:35 +08:00
|
|
|
If Hyper-threading is enabled, it's important to avoid running
|
2018-11-03 02:39:35 +08:00
|
|
|
sensitive context (if containing security data which a given VM
|
2018-12-06 08:54:36 +08:00
|
|
|
has no permission to access) on the same physical core that runs
|
2018-11-03 02:39:35 +08:00
|
|
|
said VM. It requires scheduler enhancement to enable core-based
|
|
|
|
scheduling policy, so all threads on the same core are always
|
|
|
|
scheduled to the same VM. Also there are some further actions
|
|
|
|
required to protect hypervisor and secure world from sibling
|
|
|
|
attacks in core-based scheduler.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
.. note:: There is no current plan to implement this scheduling
|
|
|
|
policy. The ACRN community will evaluate the need for this based
|
|
|
|
on usage requirements and hardware platform status.
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
Mitigation Recommendations
|
2018-11-03 02:39:35 +08:00
|
|
|
**************************
|
2018-11-03 02:35:17 +08:00
|
|
|
|
|
|
|
There is no mitigation required on Apollo Lake based platforms.
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
The majority use case for ACRN is in pre-configured environment,
|
2020-04-11 01:44:30 +08:00
|
|
|
where the whole software stack (from ACRN hypervisor to guest
|
|
|
|
kernel to Service VM root) is tightly controlled by solution provider
|
2020-10-03 06:24:32 +08:00
|
|
|
and not allowed for run time change after sale (guest kernel is
|
2018-11-03 02:39:35 +08:00
|
|
|
trusted). In that case solution provider will make sure that guest
|
|
|
|
kernel is up-to-date including necessary page table sanitization,
|
|
|
|
thus there is no attack interface exposed within guest. Then a
|
|
|
|
minimal mitigation configuration is sufficient with negligible
|
|
|
|
performance impact, as explained below:
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
1) Use latest microcode
|
2018-11-03 02:35:17 +08:00
|
|
|
2) Guest kernel is up-to-date with page table sanitization
|
|
|
|
3) EPT sanitization (always enabled)
|
|
|
|
4) Flush L1D at world switch (Android specific, always enabled)
|
|
|
|
|
|
|
|
In case that someone wants to deploy ACRN into an open environment
|
2018-11-03 02:39:35 +08:00
|
|
|
where guest kernel is considered untrusted, there are more
|
2018-11-03 02:35:17 +08:00
|
|
|
mitigation options required according to the specific usage
|
|
|
|
requirements:
|
|
|
|
|
|
|
|
5) Put hypervisor security data in UC memory if possible
|
|
|
|
6) Enable L1D_FLUSH_VMENTRY option, if
|
2018-11-03 06:10:47 +08:00
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
- Doing 5) is not feasible, or
|
|
|
|
- CPU sharing is enabled (in the future)
|
2018-11-03 02:35:17 +08:00
|
|
|
|
2020-09-26 07:24:35 +08:00
|
|
|
If Hyper-threading is enabled, there is no available mitigation
|
2018-11-03 02:39:35 +08:00
|
|
|
option before core scheduling is planned. User should understand
|
2020-09-26 07:24:35 +08:00
|
|
|
the security implication and only turn on Hyper-threading
|
2018-11-03 02:35:17 +08:00
|
|
|
when the potential risk is acceptable to their usage.
|
|
|
|
|
2018-11-03 02:39:35 +08:00
|
|
|
Mitigation Status
|
|
|
|
*****************
|
|
|
|
|
|
|
|
=========================== =============
|
|
|
|
Mitigation status
|
|
|
|
=========================== =============
|
|
|
|
EPT sanitization supported
|
|
|
|
L1D flush on VMENTRY supported
|
|
|
|
L1D flush on world switch supported
|
|
|
|
Uncached security data n/a
|
|
|
|
Core scheduling n/a
|
|
|
|
=========================== =============
|