diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-10-12 04:00:49 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-10-12 04:00:49 +0000 |
| commit | c22f60e6e55f1bf300dd76d2222a93911f3b2bb2 (patch) | |
| tree | ef665e7018377f53612ac2751dcaea35a1c587b6 /5f046d5c-check-VCPUOP_register_vcpu_info-alignment.patch | |
| parent | 39a4763249cd6289e5019acfe0c98dbb169f5f2e (diff) | |
automatic import of xenopeneuler22.03_LTS
Diffstat (limited to '5f046d5c-check-VCPUOP_register_vcpu_info-alignment.patch')
| -rw-r--r-- | 5f046d5c-check-VCPUOP_register_vcpu_info-alignment.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/5f046d5c-check-VCPUOP_register_vcpu_info-alignment.patch b/5f046d5c-check-VCPUOP_register_vcpu_info-alignment.patch new file mode 100644 index 0000000..353b5cd --- /dev/null +++ b/5f046d5c-check-VCPUOP_register_vcpu_info-alignment.patch @@ -0,0 +1,55 @@ +# Commit 3fdc211b01b29f252166937238efe02d15cb5780 +# Date 2020-07-07 14:41:00 +0200 +# Author Julien Grall <jgrall@amazon.com> +# Committer Jan Beulich <jbeulich@suse.com> +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> + +--- a/xen/common/domain.c ++++ b/xen/common/domain.c +@@ -1300,10 +1300,20 @@ int map_vcpu_info(struct vcpu *v, unsign + void *mapping; + vcpu_info_t *new_info; + struct page_info *page; ++ unsigned int align; + + if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) ) + return -EINVAL; + ++#ifdef CONFIG_COMPAT ++ if ( has_32bit_shinfo(d) ) ++ align = alignof(new_info->compat); ++ else ++#endif ++ align = alignof(*new_info); ++ if ( offset & (align - 1) ) ++ return -EINVAL; ++ + if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) ) + return -EINVAL; + |
