d->arch.ctxt_switch = &csw;
+ /*
+ * Work around CVE-2018-12207? The hardware domain is already permitted
+ * to reboot the system, so doesn't need mitigating against DoS's.
+ */
+ d->arch.hvm_domain.vmx.exec_sp = is_hardware_domain(d) || opt_ept_exec_sp;
+
if ( !has_vlapic(d) )
return 0;
int nvmx_vcpu_initialise(struct vcpu *v)
{
+ struct domain *d = v->domain;
struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
struct page_info *pg = alloc_domheap_page(NULL, 0);
+ /*
+ * Gross bodge. The nested p2m logic can't cope with the CVE-2018-12207
+ * workaround of using NX EPT superpages, and livelocks. Nested HVM isn't
+ * security supported, so disable the workaround until the nested p2m
+ * logic can be improved.
+ */
+ if ( !d->arch.hvm_domain.vmx.exec_sp )
+ {
+ d->arch.hvm_domain.vmx.exec_sp = true;
+ p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_rw);
+ }
+
if ( !pg )
{
gdprintk(XENLOG_ERR, "nest: allocation for shadow vmcs failed\n");
* Don't create executable superpages if we need to shatter them to
* protect against CVE-2018-12207.
*/
- if ( !opt_ept_exec_sp && is_epte_superpage(entry) )
+ if ( !p2m->domain->arch.hvm_domain.vmx.exec_sp && is_epte_superpage(entry) )
entry->x = 0;
}