<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic xml:lang="en-us" id="flush-level1-data-cache-mitigation">
  <title>Flushing the Level 1 Data Cache</title>
  
  <body>
    <p>This aims at removing potentially sensitive data from the level 1 data cache when running guest code. However, it is made difficult by hyper-threading setups sharing the level 1 cache and thereby potentially letting the other thread in a pair refill the cache with data the user does not want the guest to see. In addition, flushing the level 1 data cache is usually not without performance side effects.</p>
    <p>Up-to-date CPU microcode is a prerequisite for the cache flushing mitigations. Some host OSes may install these automatically, though it has traditionally been a task best performed by the system firmware. So, please check with your system / mainboard manufacturer for the latest firmware update.</p>
    <p>We recommend disabling hyper threading on the host. This is traditionally done from the firmware setup, but some OSes also offers ways disable HT. In some cases it may be disabled by default, but please verify as the effectiveness of the mitigation depends on it.</p>
    <p>The default action taken by VirtualBox is to flush the level 1 data cache when a thread is scheduled to execute guest code, rather than on each VM entry. This reduces the performance impact, while making the assumption that the host OS will not handle security sensitive data from interrupt handlers and similar without taking precautions.</p>
    <p>A more aggressive flushing option is provided using the <userinput>VBoxManage modifyvm</userinput>
      <codeph>--l1d-flush-on-vm-entry</codeph> option. When enabled the level 1 data cache will be flushed on every VM entry. The performance impact is greater than with the default option, though this of course depends on the workload. Workloads producing a lot of VM exits (like networking, VGA access, and similiar) will probably be most impacted.</p>
    <p>For users not concerned by this security issue, the default mitigation can be disabled using the <userinput>VBoxManage modifyvm <varname>name</varname> --l1d-flush-on-sched off</userinput> command.</p>
  </body>
  
</topic>
