[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/4] xen/version: Drop bogus return values for XENVER_platform_parameters
A split in virtual address space is only applicable for x86 PV guests. Furthermore, the information returned for x86 64bit PV guests is wrong. Explain the problem in version.h, stating the other information that PV guests need to know. For 64bit PV guests, and all non-x86-PV guests, return 0, which is strictly less wrong than the values currently returned. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Julien Grall <julien@xxxxxxx> --- xen/common/kernel.c | 6 ++++-- xen/include/public/version.h | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/xen/common/kernel.c b/xen/common/kernel.c index ccee178ff17a..70e7dff87488 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -522,7 +522,9 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) if ( current->hcall_compat ) { compat_platform_parameters_t params = { - .virt_start = HYPERVISOR_COMPAT_VIRT_START(current->domain), + .virt_start = is_pv_vcpu(current) + ? HYPERVISOR_COMPAT_VIRT_START(current->domain) + : 0, }; if ( copy_to_guest(arg, ¶ms, 1) ) @@ -532,7 +534,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) #endif { xen_platform_parameters_t params = { - .virt_start = HYPERVISOR_VIRT_START, + .virt_start = 0, }; if ( copy_to_guest(arg, ¶ms, 1) ) diff --git a/xen/include/public/version.h b/xen/include/public/version.h index 0ff8bd9077c6..c8325219f648 100644 --- a/xen/include/public/version.h +++ b/xen/include/public/version.h @@ -42,6 +42,26 @@ typedef char xen_capabilities_info_t[1024]; typedef char xen_changeset_info_t[64]; #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t)) +/* + * This API is problematic. + * + * It is only applicable to guests which share pagetables with Xen (x86 PV + * guests), and is supposed to identify the virtual address split between + * guest kernel and Xen. + * + * For 32bit PV guests, it mostly does this, but the caller needs to know that + * Xen lives between the split and 4G. + * + * For 64bit PV guests, Xen lives at the bottom of the upper canonical range. + * This previously returned the start of the upper canonical range (which is + * the userspace/Xen split), not the Xen/kernel split (which is 8TB further + * on). This now returns 0 because the old number wasn't correct, and + * changing it to anything else would be even worse. + * + * For all guest types using hardware virt extentions, Xen is not mapped into + * the guest kernel virtual address space. This now return 0, where it + * previously returned unrelated data. + */ #define XENVER_platform_parameters 5 struct xen_platform_parameters { xen_ulong_t virt_start; -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |