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..43850b1 --- /dev/null +++ b/qubes-libvchan-xen/39_support-changed-libxenctrl-api-xen418.patch @@ -0,0 +1,61 @@ +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,11 @@ CFLAGS += -g -Wall -Wextra -Werror -fPIC -O2 -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 - + 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) ++ + libvchan-xen.so : init.o io.o + $(CC) $(LDFLAGS) -shared -o libvchan-xen.so $^ -lxenvchan -lxenctrl + clean: +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 2106098..08994a2 100644 --- a/qubes-libvchan-xen/APKBUILD +++ b/qubes-libvchan-xen/APKBUILD @@ -3,18 +3,21 @@ pkgname=qubes-libvchan-xen pkgver=4.1.13 -pkgrel=3 +pkgrel=4 _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=" cefb6b89f75936d791910d2169170536221d3123a1b33a14bea1fc5c08950ce934666719bf08eb3cc86ac055f85e6834f71e21c31189fa7299af09296c3cd99f qubes-libvchan-xen-v4.1.13.tar.gz +fedcba617d3843e41f257ff16b0a3108af844184252d4e702df8eccba21a4ef17d62c96acdb87bb4964e783b7f2f026305777be3379e7e7b51f4535a4704b52a 39_support-changed-libxenctrl-api-xen418.patch "