From 0b252eff753d557b49938f248c9ab9e6518ac88c Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 7 Dec 2023 19:33:57 -0500 Subject: [PATCH] qubes-libvchan-xen: rebuild against sen 4.18 --- ...upport-changed-libxenctrl-api-xen418.patch | 59 +++++++++++++++++++ qubes-libvchan-xen/APKBUILD | 10 +++- 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 qubes-libvchan-xen/39_support-changed-libxenctrl-api-xen418.patch diff --git a/qubes-libvchan-xen/39_support-changed-libxenctrl-api-xen418.patch b/qubes-libvchan-xen/39_support-changed-libxenctrl-api-xen418.patch new file mode 100644 index 0000000..f25fbff --- /dev/null +++ b/qubes-libvchan-xen/39_support-changed-libxenctrl-api-xen418.patch @@ -0,0 +1,59 @@ +From 8c4c3807119f27957e6c7f87d505d66d0ea4c3d0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Sat, 18 Nov 2023 18:27:28 +0100 +Subject: [PATCH] Support changed libxenctrl API in Xen 4.18.0 + +The xc_domain_getinfo() is gone, it's replaced with +xc_domain_getinfo_single. While the new API is a bit nicer, xenctrl.h +does not provide any #define to know which one is available. Check +library version in the makefile for that. +--- + vchan/Makefile.linux | 4 ++++ + vchan/io.c | 10 ++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/vchan/Makefile.linux b/vchan/Makefile.linux +index 281f2b5..587cb34 100644 +--- a/vchan/Makefile.linux ++++ b/vchan/Makefile.linux +@@ -27,6 +27,10 @@ CFLAGS += -g -Wall -Wextra -Werror -fPIC -O2 -D_GNU_SOURCE -MD -MP -MF $@.dep + all: libvchan-xen.so vchan-xen.pc + -include *.dep + ++# xenctrl.h does not provide any #define to distinguish API versions ++XENCTRL_VERSION := $(shell pkg-config --modversion xencontrol) ++CFLAGS += $(shell if printf '%s\n' '4.18.0' '$(XENCTRL_VERSION)' | \ ++ sort -CV; then echo -DHAVE_XC_DOMAIN_GETINFO_SINGLE; fi) + SO_VER = 1 + + libvchan-xen.so.$(SO_VER): init.o io.o +diff --git a/vchan/io.c b/vchan/io.c +index 3d0ed35..0c23223 100644 +--- a/vchan/io.c ++++ b/vchan/io.c +@@ -33,14 +33,24 @@ + /* check if domain is still alive */ + int libvchan__check_domain_alive(xc_interface *xc_handle, int dom) { + struct evtchn_status evst; ++#ifdef HAVE_XC_DOMAIN_GETINFO_SINGLE ++ xc_domaininfo_t dominfo; ++#else + xc_dominfo_t dominfo; ++#endif + int ret; + + /* first try using domctl, more reliable but available in a privileged + * domain only */ ++#ifdef HAVE_XC_DOMAIN_GETINFO_SINGLE ++ ret = xc_domain_getinfo_single(xc_handle, dom, &dominfo); ++ if (ret == 0) ++ return !(dominfo.flags & XEN_DOMINF_dying); ++#else + ret = xc_domain_getinfo(xc_handle, dom, 1, &dominfo); + if (ret == 1) + return dominfo.domid == (uint32_t)dom && !dominfo.dying; ++#endif + else if (ret == -1 && errno == ESRCH) + return 0; + /* otherwise fallback to xc_evtchn_status method */ diff --git a/qubes-libvchan-xen/APKBUILD b/qubes-libvchan-xen/APKBUILD index cca6839..32bb793 100644 --- a/qubes-libvchan-xen/APKBUILD +++ b/qubes-libvchan-xen/APKBUILD @@ -3,18 +3,21 @@ pkgname=qubes-libvchan-xen pkgver=4.2.1 -pkgrel=2 +pkgrel=3 _gittag=v$pkgver pkgdesc="The Qubes core libraries for installation inside a Qubes Dom0 and VM." arch="x86_64" url="https://github.com/QubesOS/qubes-core-vchan-xen" license='GPL' depends="xen" -makedepends="xen-dev" +makedepends="xen-dev coreutils" builddir="$srcdir"/qubes-core-vchan-xen-$pkgver subpackages="$pkgname-dev" -source="$pkgname-$_gittag.tar.gz::https://github.com/QubesOS/qubes-core-vchan-xen/archive/refs/tags/$_gittag.tar.gz" +source=" + $pkgname-$_gittag.tar.gz::https://github.com/QubesOS/qubes-core-vchan-xen/archive/refs/tags/$_gittag.tar.gz + 39_support-changed-libxenctrl-api-xen418.patch + " build() { cd "$builddir"/vchan @@ -27,4 +30,5 @@ package() { sha512sums=" 2094f84fd3ca36b61c4d2a243a499425153dc4d3ca944f75763c7e23b985a40cb8ac2b41aad99074b8a7f1d871aaad87da9db2ec5bbc68adc7e717a0a2fbebff qubes-libvchan-xen-v4.2.1.tar.gz +90a67ff34d3f4aa5a0534fd88192f61e4d1d94cfa26e7b2ae52ecdb0862d5b27500162a7a1eb83db072387a4573f082afdf5482caaf7070d282267ef9e044bad 39_support-changed-libxenctrl-api-xen418.patch "