diff options
Diffstat (limited to 'community/qemu')
18 files changed, 503 insertions, 535 deletions
diff --git a/community/qemu/0001-linux-user-fix-build-with-musl-on-aarch64.patch b/community/qemu/0001-linux-user-fix-build-with-musl-on-aarch64.patch deleted file mode 100644 index 1bbae7deaa5..00000000000 --- a/community/qemu/0001-linux-user-fix-build-with-musl-on-aarch64.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 806cb2ed28a16cf2894fabef034347f426f1d04e Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 15 Dec 2016 11:53:07 +0100 -Subject: [PATCH] linux-user: fix build with musl on aarch64 - -Use the standard uint64_t instead of internal __u64. - -This fixes compiler error with musl libc on aarch64: -.../qemu-2.7.0/linux-user/host/aarch64/hostdep.h:28:5: -error: unknown type name '__u64' - __u64 *pcreg = &uc->uc_mcontext.pc; - ^~~~~ - -Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> ---- - linux-user/host/aarch64/hostdep.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h -index 64f75cef49..6fd6e36b2a 100644 ---- a/linux-user/host/aarch64/hostdep.h -+++ b/linux-user/host/aarch64/hostdep.h -@@ -25,7 +25,7 @@ extern char safe_syscall_end[]; - static inline void rewind_if_in_safe_syscall(void *puc) - { - ucontext_t *uc = puc; -- __u64 *pcreg = &uc->uc_mcontext.pc; -+ uint64_t *pcreg = &uc->uc_mcontext.pc; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { diff --git a/community/qemu/0001-linux-user-fix-build-with-musl-on-ppc64le.patch b/community/qemu/0001-linux-user-fix-build-with-musl-on-ppc64le.patch deleted file mode 100644 index c3a918775ac..00000000000 --- a/community/qemu/0001-linux-user-fix-build-with-musl-on-ppc64le.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- a/linux-user/host/ppc64/hostdep.h -+++ b/linux-user/host/ppc64/hostdep.h -@@ -25,7 +25,11 @@ - static inline void rewind_if_in_safe_syscall(void *puc) - { - ucontext_t *uc = puc; -+#if defined(__GLIBC__) || defined(__UCLIBC__) - unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP]; -+#else // Musl -+ unsigned long *pcreg = &uc->uc_mcontext.gp_regs[32]; -+#endif - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { ---- a/accel/tcg/user-exec.c -+++ a/accel/tcg/user-exec.c -@@ -228,6 +228,7 @@ - */ - #ifdef linux - /* All Registers access - only for local access */ -+#if defined(__GLIBC__) || defined(__UCLIBC__) - #define REG_sig(reg_name, context) \ - ((context)->uc_mcontext.regs->reg_name) - /* Gpr Registers access */ -@@ -245,15 +246,42 @@ - /* Condition register */ - #define CR_sig(context) REG_sig(ccr, context) - -+#else // Musl -+#define REG_sig(reg_num, context) \ -+ ((context)->uc_mcontext.gp_regs[reg_num]) -+/* Gpr Registers access */ -+#define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context) -+/* Program counter */ -+#define IAR_sig(context) REG_sig(32, context) -+/* Machine State Register (Supervisor) */ -+#define MSR_sig(context) REG_sig(33, context) -+/* Count register */ -+#define CTR_sig(context) REG_sig(35, context) -+/* User's integer exception register */ -+#define XER_sig(context) REG_sig(37, context) -+/* Link register */ -+#define LR_sig(context) REG_sig(36, context) -+/* Condition register */ -+#define CR_sig(context) REG_sig(38, context) -+#endif -+ -+ - /* Float Registers access */ - #define FLOAT_sig(reg_num, context) \ - (((double *)((char *)((context)->uc_mcontext.regs + 48 * 4)))[reg_num]) - #define FPSCR_sig(context) \ - (*(int *)((char *)((context)->uc_mcontext.regs + (48 + 32 * 2) * 4))) - /* Exception Registers access */ -+#if defined(__GLIBC__) || defined(__UCLIBC__) - #define DAR_sig(context) REG_sig(dar, context) - #define DSISR_sig(context) REG_sig(dsisr, context) - #define TRAP_sig(context) REG_sig(trap, context) -+#else // Musl -+#define DAR_sig(context) REG_sig(41, context) -+#define DSISR_sig(context) REG_sig(42, context) -+#define TRAP_sig(context) REG_sig(40, context) -+#endif -+ - #endif /* linux */ - - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) diff --git a/community/qemu/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch b/community/qemu/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch deleted file mode 100644 index ba66aae1e67..00000000000 --- a/community/qemu/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 388ef67707f01fe4ad337642325ae974dd81c242 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Wed, 22 Jul 2020 02:45:00 -0600 -Subject: [PATCH 1/2] virtio host input: use safe 64-bit time accessors for - input_event - -On 32-bit systems with 64-bit time_t, input_event.time is not -directly accessible. Instead, we must use input_event_sec and -input_event_usec accessors to set the time values. - -Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> ---- - hw/input/virtio-input-host.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c -index 85daf73f1a..7b81bf09f5 100644 ---- a/hw/input/virtio-input-host.c -+++ b/hw/input/virtio-input-host.c -@@ -193,13 +193,16 @@ static void virtio_input_host_handle_status(VirtIOInput *vinput, - { - VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput); - struct input_event evdev; -+ struct timeval tv; - int rc; - -- if (gettimeofday(&evdev.time, NULL)) { -+ if (gettimeofday(&tv, NULL)) { - perror("virtio_input_host_handle_status: gettimeofday"); - return; - } - -+ evdev.input_event_sec = tv.tv_sec; -+ evdev.input_event_usec = tv.tv_usec; - evdev.type = le16_to_cpu(event->type); - evdev.code = le16_to_cpu(event->code); - evdev.value = le32_to_cpu(event->value); --- -2.27.0 - diff --git a/community/qemu/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch b/community/qemu/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch deleted file mode 100644 index b965f66edb8..00000000000 --- a/community/qemu/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch +++ /dev/null @@ -1,40 +0,0 @@ -From de7cf9878a216143db677820c23407c3b032d12c Mon Sep 17 00:00:00 2001 -From: Ariadne Conill <ariadne@dereferenced.org> -Date: Wed, 22 Jul 2020 02:51:30 -0600 -Subject: [PATCH 2/2] virtio user input: use safe 64-bit time accessors for - input_event - -On 32-bit systems with 64-bit time_t, input_event.time is not -directly accessible. Instead, we must use input_event_sec and -input_event_usec accessors to set the time values. - -Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> ---- - contrib/vhost-user-input/main.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c -index 6020c6f33a..4887a6cb44 100644 ---- a/contrib/vhost-user-input/main.c -+++ b/contrib/vhost-user-input/main.c -@@ -115,13 +115,16 @@ vi_evdev_watch(VuDev *dev, int condition, void *data) - static void vi_handle_status(VuInput *vi, virtio_input_event *event) - { - struct input_event evdev; -+ struct timeval tv; - int rc; - -- if (gettimeofday(&evdev.time, NULL)) { -+ if (gettimeofday(&tv, NULL)) { - perror("vi_handle_status: gettimeofday"); - return; - } - -+ evdev.input_event_sec = tv.tv_sec; -+ evdev.input_event_usec = tv.tv_usec; - evdev.type = le16toh(event->type); - evdev.code = le16toh(event->code); - evdev.value = le32toh(event->value); --- -2.27.0 - diff --git a/community/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch b/community/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch index 528b5d5d8bf..a4b8a2d9a8a 100644 --- a/community/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch +++ b/community/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch @@ -15,12 +15,12 @@ Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> 1 file changed, 7 insertions(+) diff --git a/linux-user/signal.c b/linux-user/signal.c -index 5ca6d62b15..e917c16d91 100644 +index 8d29bfaa6..e5eaa6268 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c -@@ -25,6 +25,13 @@ - #include "trace.h" - #include "signal-common.h" +@@ -33,6 +33,13 @@ + #include "host-signal.h" + #include "user/safe-syscall.h" +#ifndef __SIGRTMIN +#define __SIGRTMIN 32 @@ -32,6 +32,3 @@ index 5ca6d62b15..e917c16d91 100644 static struct target_sigaction sigact_table[TARGET_NSIG]; static void host_signal_handler(int host_signum, siginfo_t *info, --- -2.23.0 - diff --git a/community/qemu/APKBUILD b/community/qemu/APKBUILD index 758d2947456..91506b96c5a 100644 --- a/community/qemu/APKBUILD +++ b/community/qemu/APKBUILD @@ -3,17 +3,17 @@ # Contributor: Jakub Jirutka <jakub@jirutka.cz> # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=qemu -pkgver=6.0.0 -pkgrel=2 +pkgver=8.2.2 +pkgrel=0 pkgdesc="QEMU is a generic machine emulator and virtualizer" url="https://qemu.org/" arch="all" -license="GPL-2.0 LGPL-2" +license="GPL-2.0-only AND LGPL-2.1-only" makedepends=" - meson - bash alsa-lib-dev + bash bison + capstone-dev curl-dev flex glib-dev @@ -21,22 +21,28 @@ makedepends=" gnutls-dev gtk+3.0-dev libaio-dev + libbpf-dev libcap-dev libcap-ng-dev libjpeg-turbo-dev libnfs-dev libpng-dev libseccomp-dev + libslirp-dev libssh-dev + liburing-dev libusb-dev libxml2-dev linux-headers lzo-dev + meson ncurses-dev + numactl-dev perl pulseaudio-dev - python3 py3-sphinx + py3-sphinx_rtd_theme + python3 sdl2-dev snappy-dev spice-dev @@ -50,15 +56,28 @@ makedepends=" zlib-dev zlib-static zstd-dev - zstd-static " pkggroups="qemu" install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-upgrade" + # suid needed for qemu-bridge-helper # strip fails on .img files # some tests does not run on our builders -options="suid !strip !check" -subpackages="$pkgname-doc $pkgname-lang $pkgname-guest-agent:guest +options="suid !strip !check textrels" + +subpackages=" + $pkgname-dev + $pkgname-doc + $pkgname-lang + $pkgname-guest-agent:guest + $pkgname-guest-agent-openrc + $pkgname-tools:_tools + $pkgname-hppa-firmware:_hppa_firmware + $pkgname-ppc-firmware:_ppc_firmware + $pkgname-s390x-firmware:_s390x_firmware + $pkgname-pr-helper:_pr_helper + $pkgname-vhost-user-gpu:_vhost_user_gpu + $pkgname-bridge-helper:bridgehelper " _subsystems=" @@ -68,8 +87,10 @@ _subsystems=" arm armeb cris + hexagon hppa i386 + loongarch64 m68k microblaze microblazeel @@ -99,6 +120,7 @@ _subsystems=" system-cris system-hppa system-i386 + system-loongarch64 system-m68k system-microblaze system-microblazeel @@ -106,7 +128,6 @@ _subsystems=" system-mips64 system-mips64el system-mipsel - system-moxie system-nios2 system-or1k system-ppc @@ -136,26 +157,50 @@ _modules=" audio-oss audio-pa audio-sdl + audio-spice block-curl block-dmg-bz2 block-nfs block-ssh - hw-display-qxl - hw-usb-redirect - ui-curses - ui-gtk - ui-sdl - ui-spice-app - audio-spice chardev-spice - hw-display-virtio-gpu-pci + hw-display-qxl hw-display-virtio-gpu + hw-display-virtio-gpu-gl + hw-display-virtio-gpu-pci + hw-display-virtio-gpu-pci-gl hw-display-virtio-vga + hw-display-virtio-vga-gl hw-s390x-virtio-gpu-ccw + hw-usb-host + hw-usb-redirect + ui-curses ui-egl-headless + ui-gtk ui-opengl + ui-sdl + ui-spice-app ui-spice-core " + +case "$CARCH" in +x86) + # ui-dbus has textrels + _configure_dbus=--disable-dbus-display + ;; +*) + _modules="$_modules audio-dbus ui-dbus" + _configure_dbus=--enable-dbus-display + ;; +esac + +case "$CARCH" in +arm*|x86) ;; +*) + makedepends="$makedepends ceph-dev" + _modules="$_modules block-rbd" + _configure_rbd="--enable-rbd" +esac + for _mod in $_modules; do subpackages="$subpackages $pkgname-$_mod:_module" done @@ -163,23 +208,19 @@ subpackages="$subpackages qemu-modules:_all_modules" subpackages="$subpackages $pkgname-img" # -img must be declared the last +# https://gitlab.com/qemu-project/qemu/-/commit/91e0127087257048d2eb98b5b1a5671f53c3a36d +_edk2hash="91e0127087257048d2eb98b5b1a5671f53c3a36d" source="https://wiki.qemu-project.org/download/qemu-$pkgver.tar.xz 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch - 0001-linux-user-fix-build-with-musl-on-aarch64.patch - musl-F_SHLCK-and-F_EXLCK.patch - fix-sigevent-and-sigval_t.patch xattr_size_max.patch - 0001-linux-user-fix-build-with-musl-on-ppc64le.patch MAP_SYNC-fix.patch fix-sockios-header.patch guest-agent-shutdown.patch + lfs64.patch mips-softfloat.patch - - 0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch - 0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch + musl-initialise-msghdr.patch CVE-2021-20255.patch - CVE-2021-3527.patch $pkgname-guest-agent.confd $pkgname-guest-agent.initd @@ -188,12 +229,69 @@ source="https://wiki.qemu-project.org/download/qemu-$pkgver.tar.xz " # secfixes: +# 8.0.2-r1: +# - CVE-2023-2861 +# 8.0.0-r6: +# - CVE-2023-0330 +# 7.1.0-r4: +# - CVE-2022-2962 +# - CVE-2022-3165 +# 7.0.0-r0: +# - CVE-2021-4158 +# 6.1.0-r0: +# - CVE-2020-35503 +# - CVE-2021-3507 +# - CVE-2021-3544 +# - CVE-2021-3545 +# - CVE-2021-3546 +# - CVE-2021-3682 # 6.0.0-r2: +# - CVE-2020-35504 +# - CVE-2020-35505 +# - CVE-2020-35506 # - CVE-2021-3527 # 6.0.0-r1: +# - CVE-2021-20181 # - CVE-2021-20255 +# - CVE-2021-3392 +# - CVE-2021-3409 +# - CVE-2021-3416 +# 5.2.0-r0: +# - CVE-2020-24352 +# - CVE-2020-25723 +# - CVE-2020-25742 +# - CVE-2020-25743 +# - CVE-2020-27661 +# - CVE-2020-27821 +# - CVE-2020-29443 +# - CVE-2020-35517 +# - CVE-2021-20203 # 5.1.0-r1: +# - CVE-2020-13361 +# - CVE-2020-13362 # - CVE-2020-14364 +# - CVE-2020-15863 +# - CVE-2020-16092 +# - CVE-2020-17380 +# - CVE-2020-25084 +# - CVE-2020-25085 +# - CVE-2020-25624 +# - CVE-2020-25625 +# - CVE-2020-25741 +# - CVE-2020-28916 +# 5.0.0-r0: +# - CVE-2020-13659 +# - CVE-2020-13754 +# - CVE-2020-13791 +# - CVE-2020-13800 +# - CVE-2020-14415 +# - CVE-2020-15469 +# - CVE-2020-15859 +# - CVE-2020-27616 +# - CVE-2020-27617 +# - CVE-2021-20221 +# 4.2.0-r0: +# - CVE-2020-13765 # 2.8.1-r1: # - CVE-2016-7994 # - CVE-2016-7995 @@ -222,7 +320,7 @@ source="https://wiki.qemu-project.org/download/qemu-$pkgver.tar.xz # - CVE-2017-5931 _compile_common() { - CFLAGS="${CFLAGS/-Os/-O2}" "$builddir"/configure \ + "$builddir"/configure \ --prefix=/usr \ --localstatedir=/var \ --sysconfdir=/etc \ @@ -241,6 +339,11 @@ _compile_common() { } build() { + # it pretty much never makes sense to optimise qemu for disk size + export CFLAGS="$CFLAGS -O2" + export CXXFLAGS="$CXXFLAGS -O2" + export CPPFLAGS="$CPPFLAGS -O2" + mkdir -p "$builddir"/build \ "$builddir"/build-static @@ -249,29 +352,33 @@ build() { --enable-linux-user \ --disable-system \ --static \ + --disable-brlapi \ + --disable-bpf \ + --disable-cap-ng \ + --disable-capstone \ + --disable-curl \ + --disable-curses \ --disable-docs \ - --disable-sdl \ + --disable-gcrypt \ + --disable-gnutls \ --disable-gtk \ - --disable-spice \ - --disable-tools \ --disable-guest-agent \ --disable-guest-agent-msi \ - --disable-curses \ - --disable-curl \ - --disable-gnutls \ - --disable-gcrypt \ - --disable-nettle \ - --disable-cap-ng \ - --disable-brlapi \ - --disable-mpath \ --disable-libnfs \ - --disable-capstone + --disable-mpath \ + --disable-nettle \ + --disable-numa \ + --disable-sdl \ + --disable-spice \ + --disable-tools cd "$builddir"/build _compile_common \ --disable-linux-user \ --audio-drv-list=oss,alsa,sdl,pa \ + --enable-bpf \ --enable-cap-ng \ + --enable-capstone \ --enable-curl \ --enable-curses \ --enable-docs \ @@ -282,6 +389,7 @@ build() { --enable-linux-aio \ --enable-lzo \ --enable-modules \ + --enable-numa \ --enable-pie \ --enable-sdl \ --enable-snappy \ @@ -294,9 +402,9 @@ build() { --enable-virtfs \ --enable-vnc \ --enable-vnc-jpeg \ - --enable-vnc-png \ --enable-zstd \ - --tls-priority=@QEMU,SYSTEM + $_configure_rbd \ + $_configure_dbus } check() { @@ -326,10 +434,17 @@ package() { # Do not install HTML docs. rm -rf "$pkgdir"/usr/share/doc + # remove accel-qtest-* modules, not needed for package + rm -f "$pkgdir"/usr/lib/qemu/accel-qtest-* + + install -Dm755 "$srcdir"/$pkgname-guest-agent.initd \ + "$pkgdir"/etc/init.d/$pkgname-guest-agent + install -Dm644 "$srcdir"/$pkgname-guest-agent.confd \ + "$pkgdir"/etc/conf.d/$pkgname-guest-agent } _subsys() { - local name=${1:-"${subpkgname#$pkgname-}"} + local name=${1:-"${subpkgname#"$pkgname"-}"} pkgdesc="Qemu ${name/-/ } emulator" options="" depends="" @@ -337,8 +452,69 @@ _subsys() { system*) depends="qemu";; esac - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/qemu-$name "$subpkgdir"/usr/bin/ + amove /usr/bin/qemu-$name + + local _arch=${name#system-} + case "$name" in + system-aarch64) + amove /usr/share/qemu/edk2-aarch64-code.fd + ;; + system-arm) + amove /usr/share/qemu/edk2-arm-code.fd \ + /usr/share/qemu/edk2-arm-vars.fd + ;; + system-x86_64|system-i386) + provides="qemu-accel-tcg-$_arch" + amove /usr/lib/qemu/accel-tcg-$_arch.so \ + /usr/share/qemu/edk2-$_arch-code.fd \ + /usr/share/qemu/edk2-$_arch-secure-code.fd + ;; + system-s390x|system-hppa|system-ppc) + depends="$pkgname-$_arch-firmware" + ;; + esac +} + +_tools() { + pkgdesc="QEMU support tools" + depends="" + options="" + amove /usr/bin/qemu-edid \ + /usr/bin/qemu-keymap \ + /usr/bin/elf2dmp +} + +# keep s390x boot files in subpackage to prevent abuild from stripping it +_s390x_firmware() { + pkgdesc="QEMU s390x boot devices" + depends="" + amove /usr/share/qemu/s390-ccw.img \ + /usr/share/qemu/s390-netboot.img +} + +_hppa_firmware() { + pkgdesc="QEMU hppa firmware" + depends="" + amove /usr/share/qemu/hppa-firmware.img +} + +_ppc_firmware() { + pkgdesc="QEMU ppc firmware" + depends="" + amove /usr/share/qemu/openbios-ppc +} + +_vhost_user_gpu() { + pkgdesc="QEMU vhost user GPU device" + depends="" + options="" + amove /usr/lib/qemu/vhost-user-gpu \ + /usr/share/qemu/vhost-user/50-qemu-gpu.json +} + +_pr_helper() { + pkgdesc="QEMU pr helper utility" + amove /usr/bin/qemu-pr-helper } img() { @@ -350,6 +526,7 @@ img() { mv "$pkgdir"/usr/bin/qemu-img \ "$pkgdir"/usr/bin/qemu-io \ "$pkgdir"/usr/bin/qemu-nbd \ + "$pkgdir"/usr/bin/qemu-storage-daemon \ "$subpkgdir"/usr/bin/ # We exploit the fact that -img subpackage are created last @@ -372,11 +549,6 @@ guest() { mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/qemu-ga "$subpkgdir"/usr/bin/ - - install -Dm755 "$srcdir"/$pkgname-guest-agent.initd \ - "$subpkgdir"/etc/init.d/$pkgname-guest-agent - install -Dm644 "$srcdir"/$pkgname-guest-agent.confd \ - "$subpkgdir"/etc/conf.d/$pkgname-guest-agent } _module() { @@ -384,9 +556,10 @@ _module() { local _class=${_mod%%-*} local _m=${_mod#*-} pkgdesc="Qemu $_m $_class module" - case "$_m" in - gtk|sdl) depends="qemu-ui-opengl";; - display-virtio-vga) depends="qemu-hw-display-virtio-gpu";; + case "$_mod" in + ui-egl-headless|ui-gtk|ui-sdl|ui-spice-core) depends="qemu-ui-opengl";; + hw-display-qxl) depends="qemu-ui-spice-core";; + hw-display-virtio-vga|hw-display-virtio-gpu-gl) depends="qemu-hw-display-virtio-gpu";; esac mkdir -p "$subpkgdir"/usr/lib/qemu @@ -403,22 +576,25 @@ _all_modules() { mkdir -p "$subpkgdir" } +bridgehelper() { + pkgdesc="QEMU SUID helper for bridged networking" + install_if="$pkgname=$pkgver-r$pkgrel" + + amove usr/lib/qemu/qemu-bridge-helper \ + etc/qemu/bridge.conf +} + sha512sums=" -ee3ff00aebec4d8891d2ff6dabe4e667e510b2a4fe3f6190aa34673a91ea32dcd2db2e9bf94c2f1bf05aa79788f17cfbbedc6027c0988ea08a92587b79ee05e4 qemu-6.0.0.tar.xz -98db5e23397cfad4a7210f9f7e1c5fa5c48f065785439521c5b39325c429f2dc367c40925adff6aa8677b3192a1a98a30e93d5b9c879df523deb019c40edd9d9 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch -1ac043312864309e19f839a699ab2485bca51bbf3d5fdb39f1a87b87e3cbdd8cbda1a56e6b5c9ffccd65a8ac2f600da9ceb8713f4dbba26f245bc52bcd8a1c56 0001-linux-user-fix-build-with-musl-on-aarch64.patch -224f5b44da749921e8a821359478c5238d8b6e24a9c0b4c5738c34e82f3062ec4639d495b8b5883d304af4a0d567e38aa6623aac1aa3a7164a5757c036528ac0 musl-F_SHLCK-and-F_EXLCK.patch -5da8114b9bd2e62f0f1f0f73f393fdbd738c5dea827ea60cedffd6f6edd0f5a97489c7148d37a8ec5a148d4e65d75cbefe9353714ee6b6f51a600200133fc914 fix-sigevent-and-sigval_t.patch -4b1e26ba4d53f9f762cbd5cea8ef6f8062d827ae3ae07bc36c5b0c0be4e94fc1856ad2477e8e791b074b8a25d51ed6d0ddd75e605e54600e5dd0799143793ce4 xattr_size_max.patch -d8933df9484158c2b4888254e62117d78f8ed7c18527b249419f39c2b2ab1afa148010884b40661f8965f1ef3105580fceffdfddbb2c9221dc1c62066722ba65 0001-linux-user-fix-build-with-musl-on-ppc64le.patch -d7de79ea74e36702cac4a59e472564a55f0a663be7e63c3755e32b4b5dfbc04b390ee79f09f43f6ae706ee2aec9e005eade3c0fd4a202db60d11f436874a17d7 MAP_SYNC-fix.patch -39590476a4ebd7c1e79a4f0451b24c75b1817a2a83abaa1f71bb60b225d772152f0af8f3e51ff65645e378c536ffa6ff551dade52884d03a14b7c6a19c5c97d4 fix-sockios-header.patch -d6b81846cefd46b8fd1fb04450d4898f97dc77d11e049fb1bc8e2553bbb88c8325151d0e4bec70cc6820a5863c1d1749b99100b4747d91182856c3ca1946cb28 guest-agent-shutdown.patch -e3acdab38c17eccb87bce1dfec22ce9474dae281474b886860848ae206006b071378882b855023916bb00a86cfbe55216c3fa4336b4e402399df2a9937b8c21c mips-softfloat.patch -9541a94685cfe411120c4073e6714fd3e307d8a4954e7a760532224b3b018fc8948ee03f2338edbb6626b20b751263249c731ac1de83333048d80982371e1874 0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch -be84d316ebe4ec883e4d02a05721be5b5d478aaa5897bb8cf25431a893397b6834e46253f139b7b94d0f4186c0c90bba78968deb47a82fc06865097f8f4d7a1a 0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch -e9389a6e3b2c3b59f66ea13eb7a3515e87341a68ca14afeb1ddd0084717bf4a13f5f58dc41dadbf0f2faf8fe1ae94ba7d1469c41539c79e45fa1624c6081e904 CVE-2021-20255.patch -c9dbc74fbf298413ca4fdd943a0a6cc8869cb4d6842423f820474374835195bf71db8a46ad6aa5c9517d89b890b290dcb0b21fc9c1e80c6ea56bf29aa7c9c8e5 CVE-2021-3527.patch +dfd2e1305f9e51bfbc90a7738c69336d5f805481a626ea527b971bdfb6dbe6867e5df7461d48d1c22b79be2dc18e057ea9fa36ef593127cd8b262a5c33f1aa41 qemu-8.2.2.tar.xz +b392f229e631d149d28eb952dcd507d9e5b6975cbba123fd3dab10860fa1936d5035d8e266926652acc1d7cde6874c440beccd33d729bf346769d2c138ebbc01 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch +2c6b3b22877674f870958bb0c74ad85c814f01c98fb123142b1ce77d89adf5c08626e6eade7f627090a53b48f5cebe2a535547804345648cff91dd66f90c2d5b xattr_size_max.patch +7672a3518050f275219920f2cb088f6991ac810dba077856129d779fdf45a3e8c0302c8ca4aa58c0c38e44af80f56404006b3f250e4921fb364cd6fe7149e6ea MAP_SYNC-fix.patch +54d26c3c44730fbd2a155431558fba6a1a3f25d8c057a8e5b8b0d802cb2b6c8a12545a16069fff1b9888a15d6cb087e9750d5e2c310dfc1a3fc756509d3d963e fix-sockios-header.patch +8eed250bea980a35f4f50365e904f56aa4751aeeb2ba9a6bbc6ad27ab9842cf3c773e48be058d9456278d1cc4006e5e80e368cbcb429ccb28a25df92b11477d7 guest-agent-shutdown.patch +d5b4626193fa9b7c687a649aa5ea37d8a74fd2e556a66a71e31af618a0990e144beae253b82b89efd8a798102bcab59cf1a61a76029afcdb0bc5ed58fb40493f lfs64.patch +8a8385dbf4a232adbd51be31d64b1e3ad2333eeb0de867555f995bf1b353ec530f85a25c8b33ce6b9572edfe4bb979a0645f14b839394d8bd47c9ffcd91509a2 mips-softfloat.patch +7a6340df8aa28811af20cd23b98ba95fc8072d4d4d3a2d497604386396892cf26716d0755821e47d02c8eded203133d7dde100537c117e2a047179e4f93883cf musl-initialise-msghdr.patch +25778c29c1f2bf40572125a7b39a01227e3165ed555add44de72a714e4b9d5a91b1504f69d0df55b4e178035813d4c3eca5be048d9afa5e3647d13df3e2f5a30 CVE-2021-20255.patch d90c034cae3f9097466854ed1a9f32ab4b02089fcdf7320e8f4da13b2b1ff65067233f48809911485e4431d7ec1a22448b934121bc9522a2dc489009e87e2b1f qemu-guest-agent.confd 1cd24c2444c5935a763c501af2b0da31635aad9cf62e55416d6477fcec153cddbe7de205d99616def11b085e0dd366ba22463d2270f831d884edbc307c7864a6 qemu-guest-agent.initd 9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2 80-kvm.rules diff --git a/community/qemu/CVE-2021-20255.patch b/community/qemu/CVE-2021-20255.patch index 970c00ceb7a..63c4893135f 100644 --- a/community/qemu/CVE-2021-20255.patch +++ b/community/qemu/CVE-2021-20255.patch @@ -5,7 +5,7 @@ Link: https://bugzilla.redhat.com/show_bug.cgi?id=1930646 Signed-off-by: Neha Agarwal <nehaagarwal@microsoft.com> --- diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c -index 16e95ef9cc..2474cf3dc2 100644 +index 679f52f..9c178c1 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -279,6 +279,9 @@ typedef struct { @@ -16,12 +16,12 @@ index 16e95ef9cc..2474cf3dc2 100644 + /* Flag to avoid recursions. */ + bool busy; } EEPRO100State; - + /* Word indices in EEPROM. */ -@@ -837,6 +840,14 @@ static void action_command(EEPRO100State *s) +@@ -844,6 +847,14 @@ static void action_command(EEPRO100State *s) Therefore we limit the number of iterations. */ unsigned max_loop_count = 16; - + + if (s->busy) { + /* Prevent recursions. */ + logout("recursion in %s:%u\n", __FILE__, __LINE__); @@ -33,11 +33,11 @@ index 16e95ef9cc..2474cf3dc2 100644 for (;;) { bool bit_el; bool bit_s; -@@ -933,6 +944,7 @@ static void action_command(EEPRO100State *s) +@@ -940,6 +951,7 @@ static void action_command(EEPRO100State *s) } TRACE(OTHER, logout("CU list empty\n")); /* List is empty. Now CU is idle or suspended. */ + s->busy = false; } - + static void eepro100_cu_command(EEPRO100State * s, uint8_t val) diff --git a/community/qemu/CVE-2021-3527.patch b/community/qemu/CVE-2021-3527.patch deleted file mode 100644 index d87e5d8d270..00000000000 --- a/community/qemu/CVE-2021-3527.patch +++ /dev/null @@ -1,205 +0,0 @@ -From 3f67e2e7f135b8be4117f3c2960e78d894feaa03 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Mon, 3 May 2021 15:29:11 +0200 -Subject: usb/hid: avoid dynamic stack allocation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use autofree heap allocation instead. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> -Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> -Message-Id: <20210503132915.2335822-2-kraxel@redhat.com> ---- - hw/usb/dev-hid.c | 2 +- - hw/usb/dev-wacom.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c -index fc39bab79f..1c7ae97c30 100644 ---- a/hw/usb/dev-hid.c -+++ b/hw/usb/dev-hid.c -@@ -656,7 +656,7 @@ static void usb_hid_handle_data(USBDevice *dev, USBPacket *p) - { - USBHIDState *us = USB_HID(dev); - HIDState *hs = &us->hid; -- uint8_t buf[p->iov.size]; -+ g_autofree uint8_t *buf = g_malloc(p->iov.size); - int len = 0; - - switch (p->pid) { -diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c -index b595048635..ed687bc9f1 100644 ---- a/hw/usb/dev-wacom.c -+++ b/hw/usb/dev-wacom.c -@@ -301,7 +301,7 @@ static void usb_wacom_handle_control(USBDevice *dev, USBPacket *p, - static void usb_wacom_handle_data(USBDevice *dev, USBPacket *p) - { - USBWacomState *s = (USBWacomState *) dev; -- uint8_t buf[p->iov.size]; -+ g_autofree uint8_t *buf = g_malloc(p->iov.size); - int len = 0; - - switch (p->pid) { --- -cgit v1.2.2 - -From 7ec54f9eb62b5d177e30eb8b1cad795a5f8d8986 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Mon, 3 May 2021 15:29:12 +0200 -Subject: usb/redir: avoid dynamic stack allocation (CVE-2021-3527) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use autofree heap allocation instead. - -Fixes: 4f4321c11ff ("usb: use iovecs in USBPacket") -Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> -Message-Id: <20210503132915.2335822-3-kraxel@redhat.com> ---- - hw/usb/redirect.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c -index 17f06f3417..6a75b0dc4a 100644 ---- a/hw/usb/redirect.c -+++ b/hw/usb/redirect.c -@@ -620,7 +620,7 @@ static void usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, - .endpoint = ep, - .length = p->iov.size - }; -- uint8_t buf[p->iov.size]; -+ g_autofree uint8_t *buf = g_malloc(p->iov.size); - /* No id, we look at the ep when receiving a status back */ - usb_packet_copy(p, buf, p->iov.size); - usbredirparser_send_iso_packet(dev->parser, 0, &iso_packet, -@@ -818,7 +818,7 @@ static void usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p, - usbredirparser_send_bulk_packet(dev->parser, p->id, - &bulk_packet, NULL, 0); - } else { -- uint8_t buf[size]; -+ g_autofree uint8_t *buf = g_malloc(size); - usb_packet_copy(p, buf, size); - usbredir_log_data(dev, "bulk data out:", buf, size); - usbredirparser_send_bulk_packet(dev->parser, p->id, -@@ -923,7 +923,7 @@ static void usbredir_handle_interrupt_out_data(USBRedirDevice *dev, - USBPacket *p, uint8_t ep) - { - struct usb_redir_interrupt_packet_header interrupt_packet; -- uint8_t buf[p->iov.size]; -+ g_autofree uint8_t *buf = g_malloc(p->iov.size); - - DPRINTF("interrupt-out ep %02X len %zd id %"PRIu64"\n", ep, - p->iov.size, p->id); --- -cgit v1.2.2 - -From 06aa50c06c6392084244f8169d34b8e2d9c43ef2 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Mon, 3 May 2021 15:29:13 +0200 -Subject: usb/mtp: avoid dynamic stack allocation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use autofree heap allocation instead. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> -Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> -Message-Id: <20210503132915.2335822-4-kraxel@redhat.com> ---- - hw/usb/dev-mtp.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c -index bbb8274344..2a895a73b0 100644 ---- a/hw/usb/dev-mtp.c -+++ b/hw/usb/dev-mtp.c -@@ -907,7 +907,8 @@ static MTPData *usb_mtp_get_object_handles(MTPState *s, MTPControl *c, - MTPObject *o) - { - MTPData *d = usb_mtp_data_alloc(c); -- uint32_t i = 0, handles[o->nchildren]; -+ uint32_t i = 0; -+ g_autofree uint32_t *handles = g_new(uint32_t, o->nchildren); - MTPObject *iter; - - trace_usb_mtp_op_get_object_handles(s->dev.addr, o->handle, o->path); --- -cgit v1.2.2 - -From 3f8e5ae2a0cc0c482718a1c9ea111c94b7321b58 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Mon, 3 May 2021 15:29:14 +0200 -Subject: usb/xhci: sanity check packet size (CVE-2021-3527) - -Make sure the usb packet size is within the -bounds of the endpoint configuration. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Message-Id: <20210503132915.2335822-5-kraxel@redhat.com> ---- - hw/usb/hcd-xhci.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c -index 46212b1e69..7acfb8137b 100644 ---- a/hw/usb/hcd-xhci.c -+++ b/hw/usb/hcd-xhci.c -@@ -1568,6 +1568,11 @@ static int xhci_setup_packet(XHCITransfer *xfer) - qemu_sglist_destroy(&xfer->sgl); - return -1; - } -+ if (xfer->packet.iov.size > ep->max_packet_size) { -+ usb_packet_unmap(&xfer->packet, &xfer->sgl); -+ qemu_sglist_destroy(&xfer->sgl); -+ return -1; -+ } - DPRINTF("xhci: setup packet pid 0x%x addr %d ep %d\n", - xfer->packet.pid, ep->dev->addr, ep->nr); - return 0; --- -cgit v1.2.2 - -From 6d900b0752a72d1236a37dd31ff4a9e685e5ff56 Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann <kraxel@redhat.com> -Date: Mon, 3 May 2021 15:29:15 +0200 -Subject: usb: limit combined packets to 1 MiB (CVE-2021-3527) - -usb-host and usb-redirect try to batch bulk transfers by combining many -small usb packets into a single, large transfer request, to reduce the -overhead and improve performance. - -This patch adds a size limit of 1 MiB for those combined packets to -restrict the host resources the guest can bind that way. - -Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> -Message-Id: <20210503132915.2335822-6-kraxel@redhat.com> ---- - hw/usb/combined-packet.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c -index 5d57e883dc..e56802f89a 100644 ---- a/hw/usb/combined-packet.c -+++ b/hw/usb/combined-packet.c -@@ -171,7 +171,9 @@ void usb_ep_combine_input_packets(USBEndpoint *ep) - if ((p->iov.size % ep->max_packet_size) != 0 || !p->short_not_ok || - next == NULL || - /* Work around for Linux usbfs bulk splitting + migration */ -- (totalsize == (16 * KiB - 36) && p->int_req)) { -+ (totalsize == (16 * KiB - 36) && p->int_req) || -+ /* Next package may grow combined package over 1MiB */ -+ totalsize > 1 * MiB - ep->max_packet_size) { - usb_device_handle_data(ep->dev, first); - assert(first->status == USB_RET_ASYNC); - if (first->combined) { --- -cgit v1.2.2 - diff --git a/community/qemu/MAP_SYNC-fix.patch b/community/qemu/MAP_SYNC-fix.patch index e13609d7315..046a952c4cb 100644 --- a/community/qemu/MAP_SYNC-fix.patch +++ b/community/qemu/MAP_SYNC-fix.patch @@ -1,5 +1,5 @@ diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c -index f7f177d..7598960 100644 +index 5b90cb6..ea7a06b 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -10,14 +10,16 @@ @@ -19,4 +19,4 @@ index f7f177d..7598960 100644 -#include "qemu/osdep.h" #include "qemu/mmap-alloc.h" #include "qemu/host-utils.h" - + #include "qemu/cutils.h" diff --git a/community/qemu/fix-sigevent-and-sigval_t.patch b/community/qemu/fix-sigevent-and-sigval_t.patch deleted file mode 100644 index 1f99eacb604..00000000000 --- a/community/qemu/fix-sigevent-and-sigval_t.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- qemu-2.2.1/linux-user/syscall.c.orig 2015-04-10 07:10:06.305662505 +0000 -+++ qemu-2.2.1/linux-user/syscall.c 2015-04-10 07:36:53.801871968 +0000 -@@ -5020,9 +5020,20 @@ - return 0; - } - --static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp, -+struct host_sigevent { -+ union sigval sigev_value; -+ int sigev_signo; -+ int sigev_notify; -+ union { -+ int _pad[64-sizeof(int) * 2 + sizeof(union sigval)]; -+ int _tid; -+ } _sigev_un; -+}; -+ -+static inline abi_long target_to_host_sigevent(struct sigevent *sevp, - abi_ulong target_addr) - { -+ struct host_sigevent *host_sevp = (struct host_sigevent *) sevp; - struct target_sigevent *target_sevp; - - if (!lock_user_struct(VERIFY_READ, target_sevp, target_addr, 1)) { diff --git a/community/qemu/fix-sockios-header.patch b/community/qemu/fix-sockios-header.patch index 1f3cd767c17..57685525458 100644 --- a/community/qemu/fix-sockios-header.patch +++ b/community/qemu/fix-sockios-header.patch @@ -1,13 +1,12 @@ diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 43d0562..afa0ac4 100644 +index c46b0114e..de280af22 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -59,6 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, +@@ -59,6 +59,7 @@ #include <linux/icmp.h> #include <linux/icmpv6.h> - #include <linux/errqueue.h> + #include <linux/if_tun.h> +#include <linux/sockios.h> + #include <linux/in6.h> + #include <linux/errqueue.h> #include <linux/random.h> - #include "qemu-common.h" - #ifdef CONFIG_TIMERFD - #include <sys/timerfd.h> diff --git a/community/qemu/guest-agent-shutdown.patch b/community/qemu/guest-agent-shutdown.patch index ddf3fdf0087..6bc6f3ee1f1 100644 --- a/community/qemu/guest-agent-shutdown.patch +++ b/community/qemu/guest-agent-shutdown.patch @@ -1,6 +1,8 @@ ---- a/qga/commands-posix.c 2021-04-30 14:07:31.202337082 +0000 -+++ b/qga/commands-posix.c 2021-04-30 14:10:05.253272361 +0000 -@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int +diff --git a/qga/commands-posix.c b/qga/commands-posix.c +index 954efed01..61427652c 100644 +--- a/qga/commands-posix.c ++++ b/qga/commands-posix.c +@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp) void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) { const char *shutdown_flag; @@ -8,25 +10,25 @@ Error *local_err = NULL; pid_t pid; int status; -@@ -91,10 +92,13 @@ void qmp_guest_shutdown(bool has_mode, c +@@ -101,10 +102,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) slog("guest-shutdown called, mode: %s", mode); if (!has_mode || strcmp(mode, "powerdown") == 0) { - shutdown_flag = "-P"; + shutdown_flag = powerdown_flag; + fallback_cmd = "/sbin/poweroff"; } else if (strcmp(mode, "halt") == 0) { - shutdown_flag = "-H"; + shutdown_flag = halt_flag; + fallback_cmd = "/sbin/halt"; } else if (strcmp(mode, "reboot") == 0) { - shutdown_flag = "-r"; + shutdown_flag = reboot_flag; + fallback_cmd = "/sbin/reboot"; } else { error_setg(errp, "mode is invalid (valid values are: halt|powerdown|reboot"); -@@ -111,6 +115,7 @@ void qmp_guest_shutdown(bool has_mode, c - - execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", - "hypervisor initiated shutdown", (char *)NULL, environ); +@@ -125,6 +129,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) + #else + execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", + "hypervisor initiated shutdown", (char *)NULL); + execle(fallback_cmd, fallback_cmd, (char*)NULL, environ); + #endif _exit(EXIT_FAILURE); } else if (pid < 0) { - error_setg_errno(errp, errno, "failed to create child process"); diff --git a/community/qemu/lfs64.patch b/community/qemu/lfs64.patch new file mode 100644 index 00000000000..3654d5e75cc --- /dev/null +++ b/community/qemu/lfs64.patch @@ -0,0 +1,204 @@ +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index bbba2a6..38fa09a 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd) + ret = cmd; + break; + case TARGET_F_GETLK: +- ret = F_GETLK64; ++ ret = F_GETLK; + break; + case TARGET_F_SETLK: +- ret = F_SETLK64; ++ ret = F_SETLK; + break; + case TARGET_F_SETLKW: +- ret = F_SETLKW64; ++ ret = F_SETLKW; + break; + case TARGET_F_GETOWN: + ret = F_GETOWN; +@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd) + break; + #if TARGET_ABI_BITS == 32 + case TARGET_F_GETLK64: +- ret = F_GETLK64; ++ ret = F_GETLK; + break; + case TARGET_F_SETLK64: +- ret = F_SETLK64; ++ ret = F_SETLK; + break; + case TARGET_F_SETLKW64: +- ret = F_SETLKW64; ++ ret = F_SETLKW; + break; + #endif + case TARGET_F_SETLEASE: +@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd) + * them to 5, 6 and 7 before making the syscall(). Since we make the + * syscall directly, adjust to what is supported by the kernel. + */ +- if (ret >= F_GETLK64 && ret <= F_SETLKW64) { +- ret -= F_GETLK64 - 5; ++ if (ret >= F_GETLK && ret <= F_SETLKW) { ++ ret -= F_GETLK - 5; + } + #endif + +@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type) + return type; + } + +-static inline abi_long copy_from_user_flock(struct flock64 *fl, ++static inline abi_long copy_from_user_flock(struct flock *fl, + abi_ulong target_flock_addr) + { + struct target_flock *target_fl; +@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl, + } + + static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++ const struct flock *fl) + { + struct target_flock *target_fl; + short l_type; +@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, + return 0; + } + +-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr); +-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl); ++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr); ++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl); + + #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 + struct target_oabi_flock64 { +@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 { + abi_int l_pid; + } QEMU_PACKED; + +-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl, + abi_ulong target_flock_addr) + { + struct target_oabi_flock64 *target_fl; +@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, + } + + static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++ const struct flock *fl) + { + struct target_oabi_flock64 *target_fl; + short l_type; +@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, + } + #endif + +-static inline abi_long copy_from_user_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_flock64(struct flock *fl, + abi_ulong target_flock_addr) + { + struct target_flock64 *target_fl; +@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl, + } + + static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++ const struct flock *fl) + { + struct target_flock64 *target_fl; + short l_type; +@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, + + static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + { +- struct flock64 fl64; ++ struct flock fl64; + #ifdef F_GETOWN_EX + struct f_owner_ex fox; + struct target_f_owner_ex *target_fox; +@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1 + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(truncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(truncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1, + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, ret); + return ret; + case TARGET_NR_pwrite64: +@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, 0); + return ret; + #endif +@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + case TARGET_NR_fcntl64: + { + int cmd; +- struct flock64 fl; ++ struct flock fl; + from_flock64_fn *copyfrom = copy_from_user_flock64; + to_flock64_fn *copyto = copy_to_user_flock64; + diff --git a/community/qemu/mips-softfloat.patch b/community/qemu/mips-softfloat.patch index 28c264a5d9b..41cc79afff9 100644 --- a/community/qemu/mips-softfloat.patch +++ b/community/qemu/mips-softfloat.patch @@ -2,10 +2,10 @@ This patch is needed due to our mips64 build uses softfloat. Qemu will not build without this patch. diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c -index 4ba5e1d..313256c 100644 +index 8ce0ca154..41198adcd 100644 --- a/tests/fp/fp-bench.c +++ b/tests/fp/fp-bench.c -@@ -479,6 +479,7 @@ static void QEMU_NORETURN die_host_rounding(enum rounding rounding) +@@ -553,6 +553,7 @@ void die_host_rounding(enum rounding rounding) exit(EXIT_FAILURE); } @@ -13,7 +13,7 @@ index 4ba5e1d..313256c 100644 static void set_host_precision(enum rounding rounding) { int rhost; -@@ -507,6 +508,7 @@ static void set_host_precision(enum rounding rounding) +@@ -581,6 +582,7 @@ static void set_host_precision(enum rounding rounding) die_host_rounding(rounding); } } @@ -21,7 +21,7 @@ index 4ba5e1d..313256c 100644 static void set_soft_precision(enum rounding rounding) { -@@ -596,9 +598,11 @@ static void parse_args(int argc, char *argv[]) +@@ -672,9 +674,11 @@ static void parse_args(int argc, char *argv[]) /* set precision and rounding mode based on the tester */ switch (tester) { diff --git a/community/qemu/musl-F_SHLCK-and-F_EXLCK.patch b/community/qemu/musl-F_SHLCK-and-F_EXLCK.patch deleted file mode 100644 index 316819afab6..00000000000 --- a/community/qemu/musl-F_SHLCK-and-F_EXLCK.patch +++ /dev/null @@ -1,19 +0,0 @@ -This patch was not upstreamed to qemu as those should probably be -defined in musl libc. - ---- ./linux-user/syscall.c.orig -+++ ./linux-user/syscall.c -@@ -114,6 +114,13 @@ - - #include "qemu.h" - -+#ifndef F_SHLCK -+#define F_SHLCK 8 -+#endif -+#ifndef F_EXLCK -+#define F_EXLCK 4 -+#endif -+ - #ifndef CLONE_IO - #define CLONE_IO 0x80000000 /* Clone io context */ - #endif diff --git a/community/qemu/musl-initialise-msghdr.patch b/community/qemu/musl-initialise-msghdr.patch new file mode 100644 index 00000000000..c980b7e3658 --- /dev/null +++ b/community/qemu/musl-initialise-msghdr.patch @@ -0,0 +1,16 @@ +Patch-Source: https://github.com/void-linux/void-packages/blob/master/srcpkgs/qemu/patches/musl-initialize-msghdr.patch +Ref: https://github.com/void-linux/void-packages/issues/23557 + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 14fdebd..de280af 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp, + int flags, int send) + { + abi_long ret, len; +- struct msghdr msg; ++ struct msghdr msg = {0}; + abi_ulong count; + struct iovec *vec; + abi_ulong target_vec; diff --git a/community/qemu/qemu.pre-install b/community/qemu/qemu.pre-install index 3394b7e0d32..7446f370edb 100644 --- a/community/qemu/qemu.pre-install +++ b/community/qemu/qemu.pre-install @@ -2,6 +2,6 @@ addgroup -S -g 34 kvm 2>/dev/null addgroup -S -g 36 qemu 2>/dev/null -adduser -S -H -h /dev/null -u 36 -G kvm -s /sbin/nologin qemu 2>/dev/null +adduser -S -H -h /dev/null -u 36 -G kvm -s /sbin/nologin -g qemu qemu 2>/dev/null exit 0 diff --git a/community/qemu/xattr_size_max.patch b/community/qemu/xattr_size_max.patch index 1a33cbf5e8b..e1d4841e1dd 100644 --- a/community/qemu/xattr_size_max.patch +++ b/community/qemu/xattr_size_max.patch @@ -1,10 +1,10 @@ diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c -index faebd91..a0f15b6 100644 +index aebadeaa0..40aea9aae 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c -@@ -25,6 +25,10 @@ - #include "trace.h" - #include "migration/migration.h" +@@ -39,6 +39,10 @@ + #include "qemu/xxhash.h" + #include <math.h> +#ifdef __linux__ +#include <linux/limits.h> /* for XATTR_SIZE_MAX */ |