* [PULL 1/8] seccomp: really fix blocking of setns/execveat/unshare
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 2/8] seccomp: drop redundant match for clone() flags == 0 Daniel P. Berrangé
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Marc-André Lureau
The previous fix for setns/execveat/unshare mistakenly copy and
pasted the clone_args filter, which is inappropriate for these
syscalls and had the effect of weakening the seccomp filter.
Fixes: f33fb19cab (seccomp: fix blocking of setns/execveat/unshare)
Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/4671
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
system/qemu-seccomp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/system/qemu-seccomp.c b/system/qemu-seccomp.c
index 3889d48b4f2..cd2c1b0b747 100644
--- a/system/qemu-seccomp.c
+++ b/system/qemu-seccomp.c
@@ -250,12 +250,12 @@ static const struct QemuSeccompSyscall denylist[] = {
#endif
#ifdef __SNR_execveat
{ SCMP_SYS(execveat), QEMU_SECCOMP_SET_SPAWN,
- ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
+ 0, NULL, SCMP_ACT_ERRNO(EPERM) },
#endif
{ SCMP_SYS(setns), QEMU_SECCOMP_SET_SPAWN,
- ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
+ 0, NULL, SCMP_ACT_ERRNO(EPERM) },
{ SCMP_SYS(unshare), QEMU_SECCOMP_SET_SPAWN,
- ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
+ 0, NULL, SCMP_ACT_ERRNO(EPERM) },
/* resource control */
{ SCMP_SYS(setpriority), QEMU_SECCOMP_SET_RESOURCECTL,
0, NULL, SCMP_ACT_ERRNO(EPERM) },
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 2/8] seccomp: drop redundant match for clone() flags == 0
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 1/8] seccomp: really fix blocking of setns/execveat/unshare Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 3/8] qtest: fail fast when QEMU terminates early Daniel P. Berrangé
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Marc-André Lureau
We have seccomp matches for clone() which mandate the presence of
several flags, in order to permit pthreads_create:
REQUIRE_CLONE_FLAG(CLONE_VM);
REQUIRE_CLONE_FLAG(CLONE_FS);
...
Given those mandatory matches, it is impossible for flags == 0 to
pass the filter. This is fortunate, since the explicit match on
flags == 0 is in fact broken, as it has a silent size extension
from 32-bits to 64-bits.
This results in seccomp generating pseudo code of:
if ($arch == 3221225534)
# filter for syscall "clone" (56) [priority: 65531]
if ($syscall == 56)
if ($a0.hi32 & 0xffffffff == 0)
if ($a0.lo32 & 0xffffff00 == 0)
action ERRNO(1);
# default action
action ALLOW;
# invalid architecture action
action KILL;
Since the clone() flag is passed as a 32-bit value in the syscall,
the high 32-bits are liable to be undefined/uninitialized garbage
The desired match for flags == 0 was
if ($arch == 3221225534)
# filter for syscall "clone" (56) [priority: 65532]
if ($syscall == 56)
if ($a0.hi32 & 0x00000000 == 0)
if ($a0.lo32 & 0xffffff00 == 0)
action ERRNO(1);
# default action
action ALLOW;
# invalid architecture action
action KILL;
That is redundant, however, as can be seen if we look at the
(fixed) program with the CLONE_THREAD rule also present:
if ($arch == 3221225534)
# filter for syscall "clone" (56) [priority: 65532]
if ($syscall == 56)
if ($a0.hi32 & 0x00000000 == 0)
if ($a0.lo32 & 0xffffff00 == 0)
action ERRNO(1);
if ($a0.lo32 & 0x00010000 == 0)
action ERRNO(1);
# default action
action ALLOW;
# invalid architecture action
action KILL;
That "($a0.lo32 & 0x00010000 == 0)" match will catch the case
of flags == 0 and do the right thing.
Reported-by: Ricardo Branco (https://gitlab.com/ricardobranco777)
Related: https://gitlab.com/qemu-project/qemu/-/work_items/4671
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
system/qemu-seccomp.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/system/qemu-seccomp.c b/system/qemu-seccomp.c
index cd2c1b0b747..a71cf66028d 100644
--- a/system/qemu-seccomp.c
+++ b/system/qemu-seccomp.c
@@ -76,13 +76,6 @@ const struct scmp_arg_cmp sched_setscheduler_arg[] = {
{ SCMP_SYS(clone), QEMU_SECCOMP_SET_SPAWN, \
ARRAY_SIZE(clone_arg ## flag), clone_arg ## flag, SCMP_ACT_ERRNO(EPERM) }
-/* If no CLONE_* flags are set, except CSIGNAL, deny */
-const struct scmp_arg_cmp clone_arg_none[] = {
- { .arg = CLONE_FLAGS_ARG,
- .op = SCMP_CMP_MASKED_EQ,
- .datum_a = ~(CSIGNAL), .datum_b = 0 }
-};
-
/*
* pthread_create should always set all of these.
*/
@@ -219,8 +212,6 @@ static const struct QemuSeccompSyscall denylist[] = {
0, NULL, SCMP_ACT_ERRNO(EPERM) },
{ SCMP_SYS(execve), QEMU_SECCOMP_SET_SPAWN,
0, NULL, SCMP_ACT_ERRNO(EPERM) },
- { SCMP_SYS(clone), QEMU_SECCOMP_SET_SPAWN,
- ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
RULE_CLONE_FLAG(CLONE_VM),
RULE_CLONE_FLAG(CLONE_FS),
RULE_CLONE_FLAG(CLONE_FILES),
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 3/8] qtest: fail fast when QEMU terminates early
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 1/8] seccomp: really fix blocking of setns/execveat/unshare Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 2/8] seccomp: drop redundant match for clone() flags == 0 Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 4/8] qom: deprecate use of instance level properties Daniel P. Berrangé
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Fabiano Rosas
If QEMU fails to start, or crashes early, before libqtest has opened
its qtest and QMP sockets, we'll get into an 'accept()' call with a
50 second timeout waiting for a connection that the zombie QEMU
process will never initiate.
Use a short 250ms timeout with accept(), but loop 200 times instead,
checking whether the process is alive on each iteration. With this
qtest detects dead QEMU immediately.
socket_accept is renamed to qtest_socket_accept to reflect that it
now requires QTestState.
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/qtest/libqtest.c | 45 ++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 05d88476154..9e7a2d43a18 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -44,13 +44,14 @@
#define MAX_IRQ 256
+#define ACCEPT_TIMEOUT_MS 250
+#define ACCEPT_RETRIES (4 * 50)
+
#ifndef _WIN32
-# define SOCKET_TIMEOUT 50
# define CMD_EXEC "exec "
# define DEV_STDERR "/dev/fd/2"
# define DEV_NULL "/dev/null"
#else
-# define SOCKET_TIMEOUT 50000
# define CMD_EXEC ""
# define DEV_STDERR "2"
# define DEV_NULL "nul"
@@ -116,20 +117,17 @@ static int init_socket(const char *socket_path)
return sock;
}
-static int socket_accept(int sock)
+static int qtest_socket_accept(QTestState *s, int sock)
{
struct sockaddr_un addr;
socklen_t addrlen;
int ret;
- /*
- * timeout unit of blocking receive calls is different among platforms.
- * It's in seconds on non-Windows platforms but milliseconds on Windows.
- */
+ size_t i;
#ifndef _WIN32
- struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT,
- .tv_usec = 0 };
+ struct timeval timeout = { .tv_sec = 0,
+ .tv_usec = ACCEPT_TIMEOUT_MS * 1000ul };
#else
- DWORD timeout = SOCKET_TIMEOUT;
+ DWORD timeout = ACCEPT_TIMEOUT_MS;
#endif
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
@@ -140,13 +138,26 @@ static int socket_accept(int sock)
return -1;
}
- do {
+ for (i = 0; i < ACCEPT_RETRIES ; i++) {
+ if (!qtest_probe_child(s)) {
+ fprintf(stderr,
+ "child process unexpectedly exited, skipping socket accept\n");
+ goto cleanup;
+ }
+
addrlen = sizeof(addr);
ret = accept(sock, (struct sockaddr *)&addr, &addrlen);
- } while (ret == -1 && errno == EINTR);
- if (ret == -1) {
- fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno));
+ if (ret == -1) {
+ if (errno == EINTR || errno == EAGAIN) {
+ continue;
+ } else {
+ fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno));
+ }
+ }
+ return ret;
}
+
+ cleanup:
close(sock);
return ret;
@@ -549,9 +560,9 @@ void qtest_connect(QTestState *s)
g_autofree gchar *qmp_socket_path = qtest_socket_path("qmp");
g_assert(s->sock >= 0 && s->qmpsock >= 0);
- s->fd = socket_accept(s->sock);
+ s->fd = qtest_socket_accept(s, s->sock);
if (s->fd >= 0) {
- s->qmp_fd = socket_accept(s->qmpsock);
+ s->qmp_fd = qtest_socket_accept(s, s->qmpsock);
}
unlink(socket_path);
unlink(qmp_socket_path);
@@ -663,7 +674,7 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s",
sock_path, extra_args);
- *sock_fd = socket_accept(sock_fd_init);
+ *sock_fd = qtest_socket_accept(qts, sock_fd_init);
unlink(sock_path);
g_free(sock_path);
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 4/8] qom: deprecate use of instance level properties
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
` (2 preceding siblings ...)
2026-10-16 9:43 ` [PULL 3/8] qtest: fail fast when QEMU terminates early Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 5/8] Revert "migration: activate TLS thread safety workaround" Daniel P. Berrangé
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé, Mark Cave-Ayland,
Philippe Mathieu-Daudé
Add API docs to object_property_(add/try_add/del) to recommend
use of class properties instead.
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
include/qom/object.h | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 4c0645817a5..90c1a34e49a 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1171,6 +1171,16 @@ void object_unref(void *obj);
* @opaque: an opaque pointer to pass to the callbacks for the property
* @errp: pointer to error object
*
+ * Further use of this method is deprecated. Properties for an
+ * object should be statically declared against the class, and
+ * not be permitted to vary at runtime. Use the
+ * object_class_property_add() method (and its variants) instead.
+ *
+ * If usage scenarios require differing subsets of properties
+ * to be present, this should be handled by creating further
+ * specialized subclasses instead of dynamically registering
+ * properties against instances.
+ *
* Returns: The #ObjectProperty; this can be used to set the @resolve
* callback for child and link properties.
*/
@@ -1183,9 +1193,6 @@ ObjectProperty *object_property_try_add(Object *obj, const char *name,
/**
* object_property_add:
- * Same as object_property_try_add() with @errp hardcoded to
- * &error_abort.
- *
* @obj: the object to add a property to
* @name: the name of the property. This can contain any character except for
* a forward slash. In general, you should use hyphens '-' instead of
@@ -1202,6 +1209,12 @@ ObjectProperty *object_property_try_add(Object *obj, const char *name,
* meant to allow a property to free its opaque upon object
* destruction. This may be NULL.
* @opaque: an opaque pointer to pass to the callbacks for the property
+ *
+ * Same as object_property_try_add() with @errp hardcoded to
+ * &error_abort.
+ *
+ * Further use of this method is deprecated, see
+ * object_property_try_add() for details.
*/
ObjectProperty *object_property_add(Object *obj, const char *name,
const char *type,
@@ -1210,6 +1223,14 @@ ObjectProperty *object_property_add(Object *obj, const char *name,
ObjectPropertyRelease *release,
void *opaque);
+/**
+ * object_property_del:
+ * @obj: the object to remove a property from
+ * @name: the property to be deleted
+ *
+ * Further use of this method is deprecated, see
+ * object_property_try_add() for details.
+ */
void object_property_del(Object *obj, const char *name);
ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name,
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 5/8] Revert "migration: activate TLS thread safety workaround"
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
` (3 preceding siblings ...)
2026-10-16 9:43 ` [PULL 4/8] qom: deprecate use of instance level properties Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 6/8] Revert "io: add support for activating " Daniel P. Berrangé
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Peter Xu, Fabiano Rosas
This reverts commit eb3618e9e259ef93f5a1a76867fbccae540fcd61.
The workaround for the GNUTLS bug was not correct and it was
decided to rely on GNUTLS being patched by distros instead,
or users manually disabling use of the problematic ciphers.
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
migration/tls.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/migration/tls.c b/migration/tls.c
index 89ba52de02a..b7914831923 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -88,10 +88,6 @@ void migration_tls_channel_process_incoming(QIOChannel *ioc, Error **errp)
trace_migration_tls_incoming_handshake_start();
qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-incoming");
- if (migrate_postcopy_ram() || migrate_return_path()) {
- qio_channel_set_feature(QIO_CHANNEL(tioc),
- QIO_CHANNEL_FEATURE_CONCURRENT_IO);
- }
qio_channel_tls_handshake(tioc,
migration_tls_incoming_handshake,
NULL,
@@ -142,11 +138,6 @@ void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc,
trace_migration_tls_outgoing_handshake_start();
qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing");
-
- if (migrate_postcopy_ram() || migrate_return_path()) {
- qio_channel_set_feature(QIO_CHANNEL(tioc),
- QIO_CHANNEL_FEATURE_CONCURRENT_IO);
- }
qio_channel_tls_handshake(tioc,
migration_tls_outgoing_handshake,
s,
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 6/8] Revert "io: add support for activating TLS thread safety workaround"
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
` (4 preceding siblings ...)
2026-10-16 9:43 ` [PULL 5/8] Revert "migration: activate TLS thread safety workaround" Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 7/8] Revert "crypto: add tracing & warning about GNUTLS countermeasures" Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 8/8] Revert "crypto: implement workaround for GNUTLS thread safety problems" Daniel P. Berrangé
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Peter Xu, Fabiano Rosas
This reverts commit edea818371bd7179b55f38d3b113d342251d8f9b.
The workaround for the GNUTLS bug was not correct and it was
decided to rely on GNUTLS being patched by distros instead,
or users manually disabling use of the problematic ciphers.
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
include/io/channel.h | 1 -
io/channel-tls.c | 5 -----
2 files changed, 6 deletions(-)
diff --git a/include/io/channel.h b/include/io/channel.h
index c90ace20d53..834ba7c3098 100644
--- a/include/io/channel.h
+++ b/include/io/channel.h
@@ -47,7 +47,6 @@ enum QIOChannelFeature {
QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY,
QIO_CHANNEL_FEATURE_READ_MSG_PEEK,
QIO_CHANNEL_FEATURE_SEEKABLE,
- QIO_CHANNEL_FEATURE_CONCURRENT_IO,
};
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 05317ed5a38..5b0524e68dd 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -261,11 +261,6 @@ void qio_channel_tls_handshake(QIOChannelTLS *ioc,
{
QIOTask *task;
- if (qio_channel_has_feature(QIO_CHANNEL(ioc),
- QIO_CHANNEL_FEATURE_CONCURRENT_IO)) {
- qcrypto_tls_session_require_thread_safety(ioc->session);
- }
-
task = qio_task_new(OBJECT(ioc),
func, opaque, destroy);
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 7/8] Revert "crypto: add tracing & warning about GNUTLS countermeasures"
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
` (5 preceding siblings ...)
2026-10-16 9:43 ` [PULL 6/8] Revert "io: add support for activating " Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
2026-10-16 9:43 ` [PULL 8/8] Revert "crypto: implement workaround for GNUTLS thread safety problems" Daniel P. Berrangé
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Peter Xu, Fabiano Rosas
This reverts commit 0db6f798024ea6f57ecf2020209b761b50a01d71.
The workaround for the GNUTLS bug was not correct and it was
decided to rely on GNUTLS being patched by distros instead,
or users manually disabling use of the problematic ciphers.
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
crypto/tlssession.c | 11 -----------
crypto/trace-events | 1 -
2 files changed, 12 deletions(-)
diff --git a/crypto/tlssession.c b/crypto/tlssession.c
index b343d1a5956..9450c83d9c3 100644
--- a/crypto/tlssession.c
+++ b/crypto/tlssession.c
@@ -19,7 +19,6 @@
*/
#include "qemu/osdep.h"
-#include "qemu/error-report.h"
#include "qemu/thread.h"
#include "crypto/tlssession.h"
#include "crypto/tlscredsanon.h"
@@ -572,20 +571,10 @@ qcrypto_tls_session_handshake(QCryptoTLSSession *session,
* only have to protect against automatic rekeying
* which doesn't trigger with CHACHA20
*/
- trace_qcrypto_tls_session_parameters(
- session,
- session->requireThreadSafety,
- gnutls_protocol_get_version(session->handle),
- cipher);
-
if (session->requireThreadSafety &&
gnutls_protocol_get_version(session->handle) ==
GNUTLS_TLS1_3 &&
cipher != GNUTLS_CIPHER_CHACHA20_POLY1305) {
- warn_report("WARNING: activating thread safety countermeasures "
- "for potentially broken GNUTLS with TLS1.3 cipher=%d",
- cipher);
- trace_qcrypto_tls_session_bug1717_workaround(session);
session->lockEnabled = true;
}
#endif
diff --git a/crypto/trace-events b/crypto/trace-events
index 771f9b8a6e8..9905ea261a9 100644
--- a/crypto/trace-events
+++ b/crypto/trace-events
@@ -23,7 +23,6 @@ qcrypto_tls_session_new(void *session, void *creds, const char *hostname, const
qcrypto_tls_session_check_creds(void *session, const char *status) "TLS session check creds session=%p status=%s"
qcrypto_tls_session_check_x509_dn(void *session, const char *dname) "TLS session check x509 distinguished name session=%p dname=%s"
qcrypto_tls_session_parameters(void *session, int threadSafety, int protocol, int cipher) "TLS session parameters session=%p threadSafety=%d protocol=%d cipher=%d"
-qcrypto_tls_session_bug1717_workaround(void *session) "TLS session bug1717 workaround session=%p"
# tls-cipher-suites.c
qcrypto_tls_cipher_suite_priority(const char *name) "priority: %s"
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PULL 8/8] Revert "crypto: implement workaround for GNUTLS thread safety problems"
2026-10-16 9:43 [PULL 0/8] Misc fixes patches Daniel P. Berrangé
` (6 preceding siblings ...)
2026-10-16 9:43 ` [PULL 7/8] Revert "crypto: add tracing & warning about GNUTLS countermeasures" Daniel P. Berrangé
@ 2026-10-16 9:43 ` Daniel P. Berrangé
7 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-10-16 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrangé, Peter Xu, Fabiano Rosas
This reverts commit 24ad5e19952b326796c8a3a1595c57ff180dab84.
The workaround for the GNUTLS bug was not correct and it was
decided to rely on GNUTLS being patched by distros instead,
or users manually disabling use of the problematic ciphers.
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
crypto/tlssession.c | 92 ++-----------------------------------
include/crypto/tlssession.h | 14 ------
meson.build | 9 ----
3 files changed, 3 insertions(+), 112 deletions(-)
diff --git a/crypto/tlssession.c b/crypto/tlssession.c
index 9450c83d9c3..0e9ca9fae0f 100644
--- a/crypto/tlssession.c
+++ b/crypto/tlssession.c
@@ -19,7 +19,6 @@
*/
#include "qemu/osdep.h"
-#include "qemu/thread.h"
#include "crypto/tlssession.h"
#include "crypto/tlscredsanon.h"
#include "crypto/tlscredspsk.h"
@@ -53,14 +52,6 @@ struct QCryptoTLSSession {
*/
Error *rerr;
Error *werr;
-
- /*
- * Used to protect against broken GNUTLS thread safety
- * https://gitlab.com/gnutls/gnutls/-/issues/1717
- */
- bool requireThreadSafety;
- bool lockEnabled;
- QemuMutex lock;
};
@@ -80,7 +71,6 @@ qcrypto_tls_session_free(QCryptoTLSSession *session)
g_free(session->authzid);
qcrypto_tls_creds_box_unref(session->credsbox);
object_unref(OBJECT(session->creds));
- qemu_mutex_destroy(&session->lock);
g_free(session);
}
@@ -96,19 +86,10 @@ qcrypto_tls_session_push(void *opaque, const void *buf, size_t len)
return -1;
};
- if (session->lockEnabled) {
- qemu_mutex_unlock(&session->lock);
- }
-
error_free(session->werr);
session->werr = NULL;
ret = session->writeFunc(buf, len, session->opaque, &session->werr);
-
- if (session->lockEnabled) {
- qemu_mutex_lock(&session->lock);
- }
-
if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
errno = EAGAIN;
return -1;
@@ -135,16 +116,7 @@ qcrypto_tls_session_pull(void *opaque, void *buf, size_t len)
error_free(session->rerr);
session->rerr = NULL;
- if (session->lockEnabled) {
- qemu_mutex_unlock(&session->lock);
- }
-
ret = session->readFunc(buf, len, session->opaque, &session->rerr);
-
- if (session->lockEnabled) {
- qemu_mutex_lock(&session->lock);
- }
-
if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
errno = EAGAIN;
return -1;
@@ -181,8 +153,6 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
session->creds = creds;
object_ref(OBJECT(creds));
- qemu_mutex_init(&session->lock);
-
if (creds->endpoint != endpoint) {
error_setg(errp, "Credentials endpoint doesn't match session");
goto error;
@@ -247,11 +217,6 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
return NULL;
}
-void qcrypto_tls_session_require_thread_safety(QCryptoTLSSession *sess)
-{
- sess->requireThreadSafety = true;
-}
-
static int
qcrypto_tls_session_check_certificate(QCryptoTLSSession *session,
Error **errp)
@@ -438,17 +403,7 @@ qcrypto_tls_session_write(QCryptoTLSSession *session,
size_t len,
Error **errp)
{
- ssize_t ret;
-
- if (session->lockEnabled) {
- qemu_mutex_lock(&session->lock);
- }
-
- ret = gnutls_record_send(session->handle, buf, len);
-
- if (session->lockEnabled) {
- qemu_mutex_unlock(&session->lock);
- }
+ ssize_t ret = gnutls_record_send(session->handle, buf, len);
if (ret < 0) {
if (ret == GNUTLS_E_AGAIN) {
@@ -476,17 +431,7 @@ qcrypto_tls_session_read(QCryptoTLSSession *session,
size_t len,
Error **errp)
{
- ssize_t ret;
-
- if (session->lockEnabled) {
- qemu_mutex_lock(&session->lock);
- }
-
- ret = gnutls_record_recv(session->handle, buf, len);
-
- if (session->lockEnabled) {
- qemu_mutex_unlock(&session->lock);
- }
+ ssize_t ret = gnutls_record_recv(session->handle, buf, len);
if (ret < 0) {
if (ret == GNUTLS_E_AGAIN) {
@@ -556,29 +501,8 @@ int
qcrypto_tls_session_handshake(QCryptoTLSSession *session,
Error **errp)
{
- int ret;
- ret = gnutls_handshake(session->handle);
-
+ int ret = gnutls_handshake(session->handle);
if (!ret) {
-#ifdef CONFIG_GNUTLS_BUG1717_WORKAROUND
- gnutls_cipher_algorithm_t cipher =
- gnutls_cipher_get(session->handle);
-
- /*
- * Any use of rekeying in TLS 1.3 is unsafe for
- * a gnutls with bug 1717, however, we know that
- * QEMU won't initiate manual rekeying. Thus we
- * only have to protect against automatic rekeying
- * which doesn't trigger with CHACHA20
- */
- if (session->requireThreadSafety &&
- gnutls_protocol_get_version(session->handle) ==
- GNUTLS_TLS1_3 &&
- cipher != GNUTLS_CIPHER_CHACHA20_POLY1305) {
- session->lockEnabled = true;
- }
-#endif
-
session->handshakeComplete = true;
return QCRYPTO_TLS_HANDSHAKE_COMPLETE;
}
@@ -616,15 +540,8 @@ qcrypto_tls_session_bye(QCryptoTLSSession *session, Error **errp)
return 0;
}
- if (session->lockEnabled) {
- qemu_mutex_lock(&session->lock);
- }
ret = gnutls_bye(session->handle, GNUTLS_SHUT_WR);
- if (session->lockEnabled) {
- qemu_mutex_unlock(&session->lock);
- }
-
if (!ret) {
return QCRYPTO_TLS_BYE_COMPLETE;
}
@@ -690,9 +607,6 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds G_GNUC_UNUSED,
return NULL;
}
-void qcrypto_tls_session_require_thread_safety(QCryptoTLSSession *sess)
-{
-}
void
qcrypto_tls_session_free(QCryptoTLSSession *sess G_GNUC_UNUSED)
diff --git a/include/crypto/tlssession.h b/include/crypto/tlssession.h
index 5415503ebab..274f4fd07ac 100644
--- a/include/crypto/tlssession.h
+++ b/include/crypto/tlssession.h
@@ -166,20 +166,6 @@ void qcrypto_tls_session_free(QCryptoTLSSession *sess);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSSession, qcrypto_tls_session_free)
-/**
- * qcrypto_tls_session_require_thread_safety:
- * @sess: the TLS session object
- *
- * Mark that this TLS session will require thread safety
- * for concurrent I/O in both directions. This must be
- * called before the handshake is performed.
- *
- * This will activate a workaround for GNUTLS thread
- * safety issues, where appropriate for the negotiated
- * TLS session parameters.
- */
-void qcrypto_tls_session_require_thread_safety(QCryptoTLSSession *sess);
-
/**
* qcrypto_tls_session_check_credentials:
* @sess: the TLS session object
diff --git a/meson.build b/meson.build
index 255c887e8e6..1dd0d6392c9 100644
--- a/meson.build
+++ b/meson.build
@@ -1795,18 +1795,11 @@ endif
gnutls = not_found
gnutls_crypto = not_found
-gnutls_bug1717_workaround = false
if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_system)
gnutls = dependency('gnutls', version: '>=3.7.5',
method: 'pkg-config',
required: get_option('gnutls'))
gnutls_crypto = gnutls
-
- #if gnutls.found() and not get_option('gnutls-bug1717-workaround').disabled()
- # XXX: when bug 1717 is resolved, add logic to probe for
- # the GNUTLS fixed version number to handle the 'auto' case
- # gnutls_bug1717_workaround = true
- #endif
endif
# We prefer use of gnutls for crypto, unless the options
@@ -2533,7 +2526,6 @@ config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
config_host_data.set('CONFIG_GETTID', has_gettid)
config_host_data.set('CONFIG_GNUTLS', gnutls.found())
config_host_data.set('CONFIG_GNUTLS_CRYPTO', gnutls_crypto.found())
-config_host_data.set('CONFIG_GNUTLS_BUG1717_WORKAROUND', gnutls_bug1717_workaround)
config_host_data.set('CONFIG_TASN1', tasn1.found())
config_host_data.set('CONFIG_GCRYPT', gcrypt.found())
config_host_data.set('CONFIG_NETTLE', nettle.found())
@@ -4906,7 +4898,6 @@ summary_info += {'TLS priority': get_option('tls_priority')}
summary_info += {'GNUTLS support': gnutls}
if gnutls.found()
summary_info += {' GNUTLS crypto': gnutls_crypto.found()}
- summary_info += {' GNUTLS bug 1717 workaround': gnutls_bug1717_workaround }
endif
summary_info += {'libgcrypt': gcrypt}
summary_info += {'nettle': nettle}
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread