hv: enable SMAP in hypervisor

With SMAP enabled, hypervisor can't access pages that
owned by guest(either SOS or UOS), and an override is
is provided: stac()/clac() to enable/disable access to
guest's memory pages.

 Pre-conditon:
    Mark hypervisor owned pages as supervisor mode (U/S = 0),
       and set all othter memory pages as user mode (U/S = 1).

Tracked-On: #2056
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yonghua Huang
2018-12-13 16:55:11 +08:00
committed by wenlingz
parent 57dfc7de05
commit 4fc5dcfc3e
22 changed files with 157 additions and 41 deletions

View File

@@ -339,6 +339,8 @@ void setup_ioapic_irqs(void)
uint8_t pin, nr_pins;
addr = map_ioapic(get_ioapic_base(ioapic_id));
hv_access_memory_region_update((uint64_t)addr, PAGE_SIZE);
nr_pins = ioapic_nr_pins(addr);
for (pin = 0U; pin < nr_pins; pin++) {
gsi_table[gsi].ioapic_id = ioapic_id;