Re: [PATCH for-5.18] KVM: fix bad user ABI for KVM_EXIT_SYSTEM_EVENT

From: Paolo Bonzini
Date: Fri Apr 29 2022 - 09:59:59 EST


On 4/29/22 06:38, Oliver Upton wrote:
+ __u64 data[16];
This is out of sync with the union { flags; data; } now.

Yes, that's intentional. The flags member is mentioned below:

+Previous versions of Linux defined a `flags` member in this struct. The
+field is now aliased to `data[0]`. Userspace can assume that it is only
+written if ndata is greater than 0.

but I don't want projects to believe it is different in any way from
`data[0]`. In particular, `flags` should also be considered valid only
if the cap is present (unless crosvm wants ARM to be grandfathered in).

IMO, we should put a giant disclaimer on all of this to*not* use the
flags field and instead only use data. I imagine we wont want to persist
the union forever as it is quite ugly, but necessary.


+/* #define KVM_CAP_VM_TSC_CONTROL 214 */

This sticks out a bit. Couldn't the VM TSC control patch just use a
different number? It seems that there will be a conflict anyway, if only to
delete this comment.

I don't want to change cap numbers once things have landed in
kvm/next, because that's when userspace projects pick them.

Paolo