diff --git a/emulators/xen-kernel/Makefile b/emulators/xen-kernel/Makefile index 4844d8675227..d08ba8c7fdb3 100644 --- a/emulators/xen-kernel/Makefile +++ b/emulators/xen-kernel/Makefile @@ -1,64 +1,65 @@ PORTNAME= xen PORTVERSION= 4.17.0 -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= emulators MASTER_SITES= http://downloads.xenproject.org/release/xen/${PORTVERSION}/ PKGNAMESUFFIX= -kernel MAINTAINER= royger@FreeBSD.org COMMENT= Hypervisor using a microkernel design WWW= https://www.xenproject.org/ LICENSE= GPLv2 ONLY_FOR_ARCHS= amd64 USES= cpe gmake python:build bison # Ports build environment has ARCH=amd64 set which disables Xen automatic arch # detection, but amd64 is not a valid arch for Xen. Hardcode x86_64 on the # command line in order to overwrite the one from the environment. MAKE_ARGS= clang=y PYTHON=${PYTHON_CMD} ARCH=x86_64 NO_MTREE= yes STRIP= # PLIST_FILES= /boot/xen \ /boot/xen-debug \ lib/debug/boot/xen.debug \ lib/debug/boot/xen-debug.debug # XSAs EXTRA_PATCHES+= ${PATCHDIR}/xsa425.patch:-p1 \ ${PATCHDIR}/xsa426.patch:-p1 \ ${PATCHDIR}/0001-xen-Work-around-Clang-IAS-macro-expansion-bug.patch:-p1 # Backports # clang build fixes EXTRA_PATCHES+= ${PATCHDIR}/0001-xen-x86-Remove-the-use-of-K-R-functions.patch:-p1 # Support for fetching video mode from PVH dom0 -EXTRA_PATCHES+= ${PATCHDIR}/0001-x86-platform-introduce-hypercall-to-get-initial-vide.patch:-p1 +EXTRA_PATCHES+= ${PATCHDIR}/0001-x86-platform-introduce-hypercall-to-get-initial-vide.patch:-p1 \ + ${PATCHDIR}/0001-x86-platform-make-XENPF_get_dom0_console-actually-us.patch:-p1 .include <bsd.port.options.mk> .if ${OPSYS} != FreeBSD IGNORE= only supported on FreeBSD .endif # The ports native 'build' target cannot be used because it sets # CFLAGS, and that breaks the Xen build system. # # Build both a production and a debug hypervisor. do-build: ${MAKE_CMD} -j${MAKE_JOBS_NUMBER} -C ${WRKSRC} build-xen ${MAKE_ARGS} debug=y cp ${WRKSRC}/xen/xen ${WRKSRC}/xen/xen-debug cp ${WRKSRC}/xen/xen-syms ${WRKSRC}/xen/xen-debug-syms ${MAKE_CMD} -j${MAKE_JOBS_NUMBER} -C ${WRKSRC} clean-xen ${MAKE_ARGS} ${MAKE_CMD} -j${MAKE_JOBS_NUMBER} -C ${WRKSRC} build-xen ${MAKE_ARGS} do-install: ${MKDIR} ${STAGEDIR}/boot ${MKDIR} ${STAGEDIR}${PREFIX}/lib/debug/boot/ ${INSTALL_PROGRAM} ${WRKSRC}/xen/xen ${STAGEDIR}/boot ${INSTALL_DATA} ${WRKSRC}/xen/xen-syms ${STAGEDIR}${PREFIX}/lib/debug/boot/xen.debug ${INSTALL_PROGRAM} ${WRKSRC}/xen/xen-debug ${STAGEDIR}/boot ${INSTALL_DATA} ${WRKSRC}/xen/xen-debug-syms ${STAGEDIR}${PREFIX}/lib/debug/boot/xen-debug.debug .include <bsd.port.mk> diff --git a/emulators/xen-kernel/files/0001-x86-platform-make-XENPF_get_dom0_console-actually-us.patch b/emulators/xen-kernel/files/0001-x86-platform-make-XENPF_get_dom0_console-actually-us.patch new file mode 100644 index 000000000000..ff57b27f5ea9 --- /dev/null +++ b/emulators/xen-kernel/files/0001-x86-platform-make-XENPF_get_dom0_console-actually-us.patch @@ -0,0 +1,58 @@ +From 7d43e4b2aa42b826e3d373b8e802ba925cc73088 Mon Sep 17 00:00:00 2001 +From: Jan Beulich <jbeulich@suse.com> +Date: Mon, 13 Mar 2023 15:14:38 +0100 +Subject: [PATCH] x86/platform: make XENPF_get_dom0_console actually usable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +struct dom0_vga_console_info has been extended in the past, and it may +be extended again. The use in PV Dom0's start info already covers for +that by supplying the size of the provided data. For the recently +introduced platform-op size needs providing similarly. Go the easiest +available route and simply supply size via the hypercall return value. + +While there also add a build-time check that possibly future growth of +the struct won't affect xen_platform_op_t's size. + +Fixes: 4dd160583c79 ("x86/platform: introduce hypercall to get initial video console settings") +Signed-off-by: Jan Beulich <jbeulich@suse.com> +Acked-by: Roger Pau Monné <roger.pau@citrix.com> +--- + xen/arch/x86/platform_hypercall.c | 2 ++ + xen/include/public/platform.h | 6 +++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c +index 08ab2fea62..85c69c5be5 100644 +--- a/xen/arch/x86/platform_hypercall.c ++++ b/xen/arch/x86/platform_hypercall.c +@@ -841,6 +841,8 @@ ret_t do_platform_op( + + #ifdef CONFIG_VIDEO + case XENPF_get_dom0_console: ++ BUILD_BUG_ON(sizeof(op->u.dom0_console) > sizeof(op->u.pad)); ++ ret = sizeof(op->u.dom0_console); + if ( !fill_console_start_info(&op->u.dom0_console) ) + { + ret = -ENODEV; +diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h +index 14784dfa77..60caa5ce7e 100644 +--- a/xen/include/public/platform.h ++++ b/xen/include/public/platform.h +@@ -605,7 +605,11 @@ struct xenpf_symdata { + typedef struct xenpf_symdata xenpf_symdata_t; + DEFINE_XEN_GUEST_HANDLE(xenpf_symdata_t); + +-/* Fetch the video console information and mode setup by Xen. */ ++/* ++ * Fetch the video console information and mode setup by Xen. A non- ++ * negative return value indicates the size of the (part of the) structure ++ * which was filled. ++ */ + #define XENPF_get_dom0_console 64 + typedef struct dom0_vga_console_info xenpf_dom0_console_t; + DEFINE_XEN_GUEST_HANDLE(xenpf_dom0_console_t); +-- +2.39.0 +