xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
authorJulien Grall <jgrall@amazon.com>
Tue, 7 Jul 2020 13:25:34 +0000 (15:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 Jul 2020 13:25:34 +0000 (15:25 +0200)
commitddaaccbbab6b19bf21ed2c097f3055a3c2544c8d
treeea06aa649c0043ebcbbeb9e91be19b03d77e1c2b
parente6ddf4a1bd8ab88f6fec83a57d64e9bbc8cca9b8
xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info

Currently a guest is able to register any guest physical address to use
for the vcpu_info structure as long as the structure can fits in the
rest of the frame.

This means a guest can provide an address that is not aligned to the
natural alignment of the structure.

On Arm 32-bit, unaligned access are completely forbidden by the
hypervisor. This will result to a data abort which is fatal.

On Arm 64-bit, unaligned access are only forbidden when used for atomic
access. As the structure contains fields (such as evtchn_pending_self)
that are updated using atomic operations, any unaligned access will be
fatal as well.

While the misalignment is only fatal on Arm, a generic check is added
as an x86 guest shouldn't sensibly pass an unaligned address (this
would result to a split lock).

This is XSA-327.

Reported-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
master commit: 3fdc211b01b29f252166937238efe02d15cb5780
master date: 2020-07-07 14:41:00 +0200
xen/common/domain.c