On Tue, Dec 12, 2023 at 10:57:17AM +0000, Alejandro Vallejo wrote:
> The procedure used to customize the domain CPU policy is broken when
> toolstack tries to set leaves (with subleaves) that the hypervisor didn't
> need to serialise (i.e: because they where empty subleaves).
> 
> During typical domain creation xg does the following:
> 
>   1. Probe Xen for max #leaves that a policy may have
>   2. Allocate memory for that many leaves
>   3. Tell the hypervisor to dump the policy in the allocated buffer
>   4. Deserialise it
>   5. Modify it
>   6. Reserialise it
>   7. Send it back to Xen
> 
> The problem is that (3) overrides nr_leaves, which then makes (6) fail in
> the case where (5) has added subleaves that Xen understands but didn't need
> to serialize on (3).
> 
> The fix uses an opaque CPU policy object so we can (a) avoid probing Xen
> for sizes, and (b) trivially have knowledge of the actual size of the
> buffer.
> 
> While at it, fix xc_cpu_policy_destroy() to preserve errno accross free()
> 
> Signed-off-by: Alejandro Vallejo <[email protected]>

Reviewed-by: Anthony PERARD <[email protected]>

Thanks,

-- 
Anthony PERARD

Reply via email to