[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V7 1/4] x86/mm: Add array_index_nospec to guest provided index values
On 08.01.2020 15:08, Alexandru Stefan ISAILA wrote: > Changes since V6: > - Remove stray spaces > - Use ARRAY_SIZE(d->arch.altp2m_p2m) insead of MAX_ALTP2M. I'm not utterly confused: > --- a/xen/arch/x86/mm/mem_access.c > +++ b/xen/arch/x86/mm/mem_access.c > @@ -366,11 +366,13 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, > uint32_t nr, > #ifdef CONFIG_HVM > if ( altp2m_idx ) > { > - if ( altp2m_idx >= MAX_ALTP2M || > - d->arch.altp2m_eptp[altp2m_idx] == mfn_x(INVALID_MFN) ) > + if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || > + d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] == > + mfn_x(INVALID_MFN) ) > return -EINVAL; > > - ap2m = d->arch.altp2m_p2m[altp2m_idx]; > + ap2m = d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, > + ARRAY_SIZE(d->arch.altp2m_p2m))]; Why is this still not ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); ? What am I missing? Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |