OpenCloudOS-Kernel/Documentation/virt/kvm
Paolo Bonzini d495f942f4 KVM: fix bad user ABI for KVM_EXIT_SYSTEM_EVENT
When KVM_EXIT_SYSTEM_EVENT was introduced, it included a flags
member that at the time was unused.  Unfortunately this extensibility
mechanism has several issues:

- x86 is not writing the member, so it would not be possible to use it
  on x86 except for new events

- the member is not aligned to 64 bits, so the definition of the
  uAPI struct is incorrect for 32- on 64-bit userspace.  This is a
  problem for RISC-V, which supports CONFIG_KVM_COMPAT, but fortunately
  usage of flags was only introduced in 5.18.

Since padding has to be introduced, place a new field in there
that tells if the flags field is valid.  To allow further extensibility,
in fact, change flags to an array of 16 values, and store how many
of the values are valid.  The availability of the new ndata field
is tied to a system capability; all architectures are changed to
fill in the field.

To avoid breaking compilation of userspace that was using the flags
field, provide a userspace-only union to overlap flags with data[0].
The new field is placed at the same offset for both 32- and 64-bit
userspace.

Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Peter Gonda <pgonda@google.com>
Cc: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Message-Id: <20220422103013.34832-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-04-29 12:38:22 -04:00
..
arm KVM: arm64: Fix Function ID typo for PTP_KVM service 2021-04-20 17:19:08 +01:00
devices Merge branch kvm-arm64/misc-5.18 into kvmarm-master/next 2022-03-09 11:16:48 +00:00
s390 Documentation: KVM: add separate directories for architecture-specific documentation 2022-03-29 13:21:20 -04:00
x86 Documentation: KVM: Add SPDX-License-Identifier tag 2022-04-11 13:28:56 -04:00
api.rst KVM: fix bad user ABI for KVM_EXIT_SYSTEM_EVENT 2022-04-29 12:38:22 -04:00
index.rst Documentation: KVM: add separate directories for architecture-specific documentation 2022-03-29 13:21:20 -04:00
locking.rst Documentation: kvm: include new locks 2022-03-29 13:21:19 -04:00
ppc-pv.rst docs: kvm: Convert ppc-pv.txt to ReST format 2020-02-12 20:10:05 +01:00
review-checklist.rst docs: fix broken references for ReST files that moved around 2020-04-20 15:45:03 -06:00
vcpu-requests.rst Documentation: KVM: Add SPDX-License-Identifier tag 2022-04-11 13:28:56 -04:00