[RFC PATCH v11 09/29] KVM: x86: Disallow hugepages when memory attributes are mixed

2023-07-18 Thread Sean Christopherson
From: Chao Peng Disallow creating hugepages with mixed memory attributes, e.g. shared versus private, as mapping a hugepage in this case would allow the guest to access memory with the wrong attributes, e.g. overlaying private memory with a shared hugepage. Tracking whether or not attributes are

Re: [RFC PATCH v11 09/29] KVM: x86: Disallow hugepages when memory attributes are mixed

2023-07-21 Thread Paolo Bonzini
On 7/19/23 01:44, Sean Christopherson wrote: +static bool range_has_attrs(struct kvm *kvm, gfn_t start, gfn_t end, + unsigned long attrs) +{ + XA_STATE(xas, &kvm->mem_attr_array, start); + unsigned long index; + bool has_attrs; + void *entry; + +

Re: [RFC PATCH v11 09/29] KVM: x86: Disallow hugepages when memory attributes are mixed

2023-07-21 Thread Sean Christopherson
On Fri, Jul 21, 2023, Paolo Bonzini wrote: > On 7/19/23 01:44, Sean Christopherson wrote: > > +static bool range_has_attrs(struct kvm *kvm, gfn_t start, gfn_t end, > > + unsigned long attrs) > > +{ > > + XA_STATE(xas, &kvm->mem_attr_array, start); > > + unsigned long index