diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-22 12:30:13 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-29 12:38:22 -0400 |
commit | d495f942f40aa412f8d4d65951152648cfa09903 (patch) | |
tree | 81a4c05ce5fb66d9bdcc613d35f235b5b93e951b /mm/damon | |
parent | 86931ff7207bc045fa5439ef97b31859613dc303 (diff) | |
download | linux-rpi-d495f942f40aa412f8d4d65951152648cfa09903.tar.gz linux-rpi-d495f942f40aa412f8d4d65951152648cfa09903.tar.bz2 linux-rpi-d495f942f40aa412f8d4d65951152648cfa09903.zip |
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>
Diffstat (limited to 'mm/damon')
0 files changed, 0 insertions, 0 deletions