Commit 87d784f6b4 for qemu.org
commit 87d784f6b449c870225ded7426f746894130b978
Author: Daniel P. Berrangé <berrange@redhat.com>
Date: Tue Dec 1 17:37:33 2026 +0000
io: fix busy-wait when uncorking
If we have corked data pending on the TLS channel, when uncorking
if we don't make progress sending any data, the code currently
busy-waits as it mistakenly expects QCRYPTO_TLS_SESSION_ERR_BLOCK.
This return value is never set by the uncork method, as that will
always return the amount of outstanding data. IOW, to detect this
situation we need to look for the amount of corked data being
unchanged.
The busy-waiting would allow a lesser privileged, but none the less
authenticated & authorized, network client to create a denial of
service attack on the whole VM which can be owned by a user with
high privileges.
Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/5027
Fixes: CVE-2026-141376
Fixes: 99a8b5a0 ("io: cork TLW writes to avoid small TLS records", v11.2.0-rc0)
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 5b0524e68d..05e89dfed7 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -462,14 +462,14 @@ static ssize_t qio_channel_tls_writev(QIOChannel *ioc,
*/
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;