On 08.08.2024 15:41, Alejandro Vallejo wrote: > --- a/xen/arch/x86/domctl.c > +++ b/xen/arch/x86/domctl.c > @@ -1344,7 +1344,10 @@ void arch_get_info_guest(struct vcpu *v, > vcpu_guest_context_u c) > #define c(fld) (c.nat->fld) > #endif > > - memcpy(&c.nat->fpu_ctxt, v->arch.fpu_ctxt, sizeof(c.nat->fpu_ctxt)); > + memcpy(&c.nat->fpu_ctxt, &v->arch.xsave_area->fpu_sse, > + sizeof(c.nat->fpu_ctxt)); > + BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) != sizeof(fpusse_t));
While it may seem unlikely that it would change going forward, I think that such build-time checks should make no implications at all. I.e. here the right side ought to be sizeof(v->arch.xsave_area->fpu_sse) even if that's longer. Personally I also think that BUILD_BUG_ON(), just like BUG_ON(), would better live ahead of the construct they're for. Same again in at least one more place. Jan