KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER
authorAlexander Graf <graf@amazon.com>
Mon, 17 Oct 2022 18:45:41 +0000 (20:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:15:25 +0000 (18:15 +0100)
commitf7d9de8a0d332bee0fffd96b46e1417eeaba306f
treed6fade8da167354d5a679826f97b08af7d19f8ef
parentb7b66f13ac094e605aefd3e4a822da2fdd3d71f5
KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER

[ Upstream commit 1739c7017fb1d759965dcbab925ff5980a5318cb ]

The KVM_X86_SET_MSR_FILTER ioctls contains a pointer in the passed in
struct which means it has a different struct size depending on whether
it gets called from 32bit or 64bit code.

This patch introduces compat code that converts from the 32bit struct to
its 64bit counterpart which then gets used going forward internally.
With this applied, 32bit QEMU can successfully set MSR bitmaps when
running on 64bit kernels.

Reported-by: Andrew Randrianasulu <randrianasulu@gmail.com>
Fixes: 1a155254ff937 ("KVM: x86: Introduce MSR filtering")
Signed-off-by: Alexander Graf <graf@amazon.com>
Message-Id: <20221017184541.2658-4-graf@amazon.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/x86.c