Merge tag 'misc-fixes-pull-request' of https://gitlab.com/berrange/qemu into staging

* fix denial of service where TLS client can cause QEMU to
  get stuck in a busy wait blocked on I/O. CVE-2026-141376
* fix denial of service where websocket client can cause
  QEMU to get stuck in a busy wait on EOF. CVE-2026-141286
* fix broken sunxi kernel URL for some arm functional tests
* don't mark virtio-crypto devices as secure

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEOSEivHoFu8YQee2OpU5XPKwd8GwFAmsSuj8ACgkQpU5XPKwd
# 8Gw6YA//aLkHqgCC1flAmgNmqyZY8fkxbVFiAlurnXndaNNJdpctmSw5a/kYWDTR
# uNL6r/zNBIWfYSVeM9J141J9z6sxBG2X2HNaViGYiTzeBQCFe+JqvuqgjAiIcEoZ
# IJ8x7ewpVwK9t5mVBMk/T4ILBxNw1EhWMVelIfnPKgpcO6XnwUA48m6H/h03uO87
# CDxLX4yUHlXJypIv20gLRqshzEKlkyvnKtVxB66ElMnH6IctGrB+g32nYjke9NBD
# 1EdJl4QFGEipf5I4pzsjTx2ZCmbNlxXUJt/Je/YVEMZ+cH+4OWXx5j0dAuddM+wX
# p8AuZvvuywBDLRE6IJmh2JxHf1KPKU6H8QrCUSVqYETrU2Nap32I5kxaRbJbjuXY
# 51VDVnsnviW7p5u98Ld5hMxNQ1GgNN808iXN2luiEC+sryfdvdSlsKZ0gaKYCtd+
# AlOEbnoLvtCOkSchPcG4P0p9rxXS6qj94mM89d4ytheA83e9Psjqkf14Mpj0rKom
# wza+xaEYCsusSLetdJkk0MoOAHRC2KIi2Ut1Jup6DK181eCn4YowunSH10N8e6cN
# czzNMq/TuwpPs1fI+MheqOz+X0cG098YakuPmvPfdk6MXo2T0xNQQDU6CVwjpA8K
# aGbqLRu4eL+nhv5vg+LwGAOP7CfOHZnDL9YtfIy2Gqn8umMht/A=
# =hyUy
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 04 Dec 2026 05:03:59 AM PST
# gpg:                using RSA key 392122BC7A05BBC61079ED8EA54E573CAC1DF06C
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [unknown]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF
#      Subkey fingerprint: 3921 22BC 7A05 BBC6 1079  ED8E A54E 573C AC1D F06C

* tag 'misc-fixes-pull-request' of https://gitlab.com/berrange/qemu:
  hw/virtio: don't mark virtio-crypto as secure
  tests/functional: update to newer sunxi kernels again
  io: fix EOF check in websocket decoding code
  io: fix busy-wait when uncorking

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c
index 7b7dd05..c4089f4 100644
--- a/hw/virtio/virtio-crypto-pci.c
+++ b/hw/virtio/virtio-crypto-pci.c
@@ -88,6 +88,6 @@
 
 static void virtio_crypto_pci_register_types(void)
 {
-    virtio_pci_types_register(&virtio_crypto_pci_info);
+    virtio_pci_types_register_insecure(&virtio_crypto_pci_info);
 }
 type_init(virtio_crypto_pci_register_types)
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 51a99a6..6d053e7 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1315,7 +1315,6 @@
     .instance_size = sizeof(VirtIOCrypto),
     .instance_init = virtio_crypto_instance_init,
     .class_init = virtio_crypto_class_init,
-    .secure = true,
 };
 
 static void virtio_register_types(void)
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 5b0524e..05e89df 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -462,14 +462,14 @@
      */
     while (tioc->corked) {
         ssize_t ret = qcrypto_tls_session_write_uncork(tioc->session, errp);
-        if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
+        if (ret < 0) {
+            return -1;
+        } else if (ret == tioc->corked) {
             if (done) {
                 return done;
             } else {
                 return QIO_CHANNEL_ERR_BLOCK;
             }
-        } else if (ret < 0) {
-            return -1;
         }
         done += (tioc->corked - ret);
         tioc->corked = ret;
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 646cd45..5f672c5 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -965,10 +965,28 @@
 }
 
 
+/*
+ * Called when either:
+ *   - rawinput is empty and an read operation wants
+ *     to decode more data
+ *   - something has a watch on G_IO_IN and wants
+ *     to know if decoded data is available
+ *
+ * At start of the call encinput may contain data
+ * previously read off the wire during the handshake
+ * that can be immediately decoded without reading
+ * more data, or incomplete frames that could not
+ * be decoded by a previous call.
+ *
+ * Returns: 1 if bytes were read, 0 on eof, -1 on error,
+ *   QIO_CHANNEL_ERR_BLOCK on blocking
+ */
 static ssize_t qio_channel_websock_read_wire(QIOChannelWebsock *ioc,
                                              Error **errp)
 {
+    ssize_t avail;
     ssize_t ret;
+    bool eof = false;
 
     if (ioc->encinput.offset < 4096 &&
         ioc->rawinput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
@@ -980,29 +998,51 @@
                                ioc->encinput.offset,
                                want,
                                errp);
-        if (ret < 0) {
+        if (ret == -1) {
             return ret;
         }
-        if (ret == 0 && ioc->encinput.offset == 0) {
-            ioc->io_eof = TRUE;
-            return 0;
+        if (ret == 0) {
+            eof = true;
         }
-        ioc->encinput.offset += ret;
+        if (ret != QIO_CHANNEL_ERR_BLOCK) {
+            ioc->encinput.offset += ret;
+        }
     }
 
+    avail = ioc->rawinput.offset;
     while (ioc->encinput.offset != 0) {
         if (ioc->payload_remain == 0) {
             ret = qio_channel_websock_decode_header(ioc, errp);
+            if (ret == QIO_CHANNEL_ERR_BLOCK) {
+                break;
+            }
             if (ret < 0) {
                 return ret;
             }
         }
 
         ret = qio_channel_websock_decode_payload(ioc, errp);
+        if (ret == QIO_CHANNEL_ERR_BLOCK) {
+            break;
+        }
         if (ret < 0) {
             return ret;
         }
     }
+
+    /*
+     * If we didn't make progress, then we either have
+     * to report EOF, or indicate the read would block
+     */
+    if (ioc->rawinput.offset == avail) {
+        if (eof) {
+            ioc->io_eof = TRUE;
+            return 0;
+        } else {
+            return QIO_CHANNEL_ERR_BLOCK;
+        }
+    }
+
     return 1;
 }
 
diff --git a/tests/functional/arm/test_bpim2u.py b/tests/functional/arm/test_bpim2u.py
index e6fd80a..69cb3e6 100755
--- a/tests/functional/arm/test_bpim2u.py
+++ b/tests/functional/arm/test_bpim2u.py
@@ -10,14 +10,16 @@
 from qemu_test import skipBigDataTest
 from qemu_test.utils import image_pow2ceil_expand
 
+from unittest import skip
+
 
 class BananaPiMachine(LinuxKernelTest):
 
     ASSET_DEB = Asset(
-        ('https://apt.armbian.com/pool/main/l/linux-6.6.44/'
-         'linux-image-current-sunxi_24.8.2_armhf__6.6.44-'
-         'S7213-D53de-P4ceb-C697eH5c21-HK01ba-V014b-B58e9-R448a.deb'),
-        'd960131bed01a8bf48882ff133a37826dfdce84138f9a82e0bea331ba795fe78')
+        ('https://apt.armbian.com/pool/main/l/linux-6.18.65/'
+         'linux-image-current-sunxi_26.11.4_armhf__6.18.65-'
+         'S4700-D7c7d-P2865-C70ca-H4b9e-HKff8b-V014b-Bdf9b-CVEfee3-R448a.deb'),
+        '2884801a24fa8da60b8ee07ec7650c1cc73571a4013c0bf4a986c136bd077715')
 
     ASSET_INITRD = Asset(
         ('https://github.com/groeck/linux-build-test/raw/'
@@ -38,8 +40,8 @@ class BananaPiMachine(LinuxKernelTest):
     def test_arm_bpim2u(self):
         self.set_machine('bpim2u')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/'
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/'
                     'sun8i-r40-bananapi-m2-ultra.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
 
@@ -57,8 +59,8 @@ def test_arm_bpim2u(self):
     def test_arm_bpim2u_initrd(self):
         self.set_machine('bpim2u')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/'
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/'
                     'sun8i-r40-bananapi-m2-ultra.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
         initrd_path = self.uncompress(self.ASSET_INITRD)
@@ -84,14 +86,15 @@ def test_arm_bpim2u_initrd(self):
         # Wait for VM to shut down gracefully
         self.vm.wait()
 
+    @skip("latest armbian sunxi kernels appear to be missing gmac driver")
     def test_arm_bpim2u_gmac(self):
         self.set_machine('bpim2u')
         self.require_netdev('user')
 
         deb_path = self.ASSET_DEB.fetch()
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/'
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/'
                     'sun8i-r40-bananapi-m2-ultra.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
         rootfs_path = self.uncompress(self.ASSET_ROOTFS)
@@ -118,7 +121,8 @@ def test_arm_bpim2u_gmac(self):
         exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
                                                 'mmcblk')
         exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
-                                                 'eth0: Link is Up')
+                                                 'eth0: Link is Up',
+                                                 'No such device')
         exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
             'udhcpc: lease of 10.0.2.15 obtained')
         exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
diff --git a/tests/functional/arm/test_cubieboard.py b/tests/functional/arm/test_cubieboard.py
index eeafc26..83c654a 100755
--- a/tests/functional/arm/test_cubieboard.py
+++ b/tests/functional/arm/test_cubieboard.py
@@ -13,10 +13,10 @@
 class CubieboardMachine(LinuxKernelTest):
 
     ASSET_DEB = Asset(
-        ('https://apt.armbian.com/pool/main/l/linux-6.6.44/'
-         'linux-image-current-sunxi_24.8.2_armhf__6.6.44-'
-         'S7213-D53de-P4ceb-C697eH5c21-HK01ba-V014b-B58e9-R448a.deb'),
-        'd960131bed01a8bf48882ff133a37826dfdce84138f9a82e0bea331ba795fe78')
+        ('https://apt.armbian.com/pool/main/l/linux-6.18.65/'
+         'linux-image-current-sunxi_26.11.4_armhf__6.18.65-'
+         'S4700-D7c7d-P2865-C70ca-H4b9e-HKff8b-V014b-Bdf9b-CVEfee3-R448a.deb'),
+        '2884801a24fa8da60b8ee07ec7650c1cc73571a4013c0bf4a986c136bd077715')
 
     ASSET_INITRD = Asset(
         ('https://github.com/groeck/linux-build-test/raw/'
@@ -38,8 +38,8 @@ class CubieboardMachine(LinuxKernelTest):
     def test_arm_cubieboard_initrd(self):
         self.set_machine('cubieboard')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/' +
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/' +
                     'sun4i-a10-cubieboard.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
         initrd_path = self.uncompress(self.ASSET_INITRD)
@@ -69,8 +69,8 @@ def test_arm_cubieboard_initrd(self):
     def test_arm_cubieboard_sata(self):
         self.set_machine('cubieboard')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/' +
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/' +
                     'sun4i-a10-cubieboard.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
 
diff --git a/tests/functional/arm/test_orangepi.py b/tests/functional/arm/test_orangepi.py
index c9cfdbd..2c690a9 100755
--- a/tests/functional/arm/test_orangepi.py
+++ b/tests/functional/arm/test_orangepi.py
@@ -16,10 +16,10 @@
 class OrangePiMachine(LinuxKernelTest):
 
     ASSET_DEB = Asset(
-        ('https://apt.armbian.com/pool/main/l/linux-6.6.44/'
-         'linux-image-current-sunxi_24.8.2_armhf__6.6.44-'
-         'S7213-D53de-P4ceb-C697eH5c21-HK01ba-V014b-B58e9-R448a.deb'),
-        'd960131bed01a8bf48882ff133a37826dfdce84138f9a82e0bea331ba795fe78')
+        ('https://apt.armbian.com/pool/main/l/linux-6.18.65/'
+         'linux-image-current-sunxi_26.11.4_armhf__6.18.65-'
+         'S4700-D7c7d-P2865-C70ca-H4b9e-HKff8b-V014b-Bdf9b-CVEfee3-R448a.deb'),
+        '2884801a24fa8da60b8ee07ec7650c1cc73571a4013c0bf4a986c136bd077715')
 
     ASSET_INITRD = Asset(
         ('https://github.com/groeck/linux-build-test/raw/'
@@ -50,8 +50,8 @@ class OrangePiMachine(LinuxKernelTest):
     def test_arm_orangepi(self):
         self.set_machine('orangepi-pc')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/' +
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/' +
                     'sun8i-h3-orangepi-pc.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
 
@@ -69,8 +69,8 @@ def test_arm_orangepi(self):
     def test_arm_orangepi_initrd(self):
         self.set_machine('orangepi-pc')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/' +
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/' +
                     'sun8i-h3-orangepi-pc.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
         initrd_path = self.uncompress(self.ASSET_INITRD)
@@ -100,8 +100,8 @@ def test_arm_orangepi_sd(self):
         self.set_machine('orangepi-pc')
         self.require_netdev('user')
         kernel_path = self.archive_extract(
-            self.ASSET_DEB, member='boot/vmlinuz-6.6.44-current-sunxi')
-        dtb_path = ('usr/lib/linux-image-6.6.44-current-sunxi/' +
+            self.ASSET_DEB, member='boot/vmlinuz-6.18.65-current-sunxi')
+        dtb_path = ('usr/lib/linux-image-6.18.65-current-sunxi/' +
                     'sun8i-h3-orangepi-pc.dtb')
         dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
         rootfs_path = self.uncompress(self.ASSET_ROOTFS)
diff --git a/tests/functional/arm/test_replay.py b/tests/functional/arm/test_replay.py
index ee61f47..b8015e2 100755
--- a/tests/functional/arm/test_replay.py
+++ b/tests/functional/arm/test_replay.py
@@ -24,10 +24,10 @@ def test_virt(self):
         self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1)
 
     ASSET_CUBIE_KERNEL = Asset(
-        ('https://apt.armbian.com/pool/main/l/linux-6.6.44/'
-         'linux-image-current-sunxi_24.8.2_armhf__6.6.44-'
-         'S7213-D53de-P4ceb-C697eH5c21-HK01ba-V014b-B58e9-R448a.deb'),
-        'd960131bed01a8bf48882ff133a37826dfdce84138f9a82e0bea331ba795fe78')
+        ('https://apt.armbian.com/pool/main/l/linux-6.18.65/'
+         'linux-image-current-sunxi_26.11.4_armhf__6.18.65-'
+         'S4700-D7c7d-P2865-C70ca-H4b9e-HKff8b-V014b-Bdf9b-CVEfee3-R448a.deb'),
+        '2884801a24fa8da60b8ee07ec7650c1cc73571a4013c0bf4a986c136bd077715')
 
     ASSET_CUBIE_INITRD = Asset(
         ('https://github.com/groeck/linux-build-test/raw/'
@@ -37,9 +37,9 @@ def test_virt(self):
     def test_cubieboard(self):
         self.set_machine('cubieboard')
         kernel_path = self.archive_extract(self.ASSET_CUBIE_KERNEL,
-            member='boot/vmlinuz-6.6.44-current-sunxi')
+            member='boot/vmlinuz-6.18.65-current-sunxi')
         dtb_path = self.archive_extract(self.ASSET_CUBIE_KERNEL,
-            member='usr/lib/linux-image-6.6.44-current-sunxi/sun4i-a10-cubieboard.dtb')
+            member='usr/lib/linux-image-6.18.65-current-sunxi/sun4i-a10-cubieboard.dtb')
         initrd_path = self.uncompress(self.ASSET_CUBIE_INITRD)
 
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +