qemu-cr16/include
Daniel P. Berrangé 24ad5e1995 crypto: implement workaround for GNUTLS thread safety problems
When TLS 1.3 is negotiated on a TLS session, GNUTLS will perform
automatic rekeying of the session after 16 million records. This
is done for all algorithms except CHACHA20_POLY1305 which does
not require rekeying.

Unfortunately the rekeying breaks GNUTLS' promise that it is safe
to use a gnutls_session_t object concurrently from multiple threads
if they are exclusively calling gnutls_record_send/recv.

This patch implements a workaround for QEMU that adds a mutex lock
around any gnutls_record_send/recv call to serialize execution
within GNUTLS code. When GNUTLS calls into the push/pull functions
we can release the lock so the OS level I/O calls can at least
have some parallelism.

The big downside of this is that the actual encryption/decryption
code is fully serialized, which will halve performance of that
cipher operations if two threads are contending.

The workaround is not enabled by default, since most use of GNUTLS
in QEMU does not tickle the problem, only non-multifd migration
with a return path open is affected. Fortunately the migration
code also won't trigger the halving of performance, since only
the outbound channel diretion needs to sustain high data rates,
the inbound direction is low volume.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/20250718150514.2635338-2-berrange@redhat.com
[add stub for qcrypto_tls_session_require_thread_safety; fix unused var]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2025-07-22 19:39:29 -03:00
..
accel accel/system: Introduce @x-accel-stats QMP command 2025-07-15 19:34:33 +02:00
authz
block blockjob: mark block_job_remove_all_bdrv() as GRAPH_UNLOCKED 2025-07-14 15:42:28 +02:00
chardev chardev/char-hub: implement backend chardev aggregator 2025-02-03 13:57:08 +04:00
crypto crypto: implement workaround for GNUTLS thread safety problems 2025-07-22 19:39:29 -03:00
disas disas: Fix build against Capstone v6 (again) 2024-11-05 10:09:59 +00:00
exec qemu: Declare all load/store helper in 'qemu/bswap.h' 2025-07-15 02:56:39 -04:00
fpu fpu: Move m68k_denormal fmt flag into floatx80_behaviour 2025-02-25 15:32:57 +00:00
gdbstub gdbstub/helpers: Replace TARGET_BIG_ENDIAN -> target_big_endian() 2025-07-15 02:56:39 -04:00
hw ppc/xive queue: 2025-07-21 14:55:31 -04:00
io io: Add helper for setting socket send buffer size 2025-05-29 16:37:15 -05:00
libdecnumber include/libdecnumber: replace FSF postal address with licenses URL 2025-06-26 00:42:37 +02:00
migration migration: Rename save_live_complete_precopy_thread to save_complete_precopy_thread 2025-07-11 10:37:39 -03:00
monitor monitor: Remove obsolete stubs 2024-06-30 19:51:44 +03:00
net virtio,pci,pc: features, fixes, tests 2025-07-16 07:00:47 -04:00
qapi util/error: make func optional 2025-06-05 20:24:51 +02:00
qemu host-utils: Drop workaround for buggy Apple Clang __builtin_subcll() 2025-07-21 10:07:53 +01:00
qobject qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
qom qom: reverse order of instance_post_init calls 2025-05-20 08:18:53 +02:00
scsi
semihosting semihosting/uaccess: Remove uses of target_ulong type 2025-07-02 10:09:48 +01:00
standard-headers update Linux headers to v6.16-rc3 2025-06-20 13:25:59 +02:00
system Accelerators patches 2025-07-16 07:13:40 -04:00
tcg accel/tcg: Propagate AccelState to dump_accel_info() 2025-07-15 19:34:33 +02:00
ui ui/gtk: Add scale option 2025-07-15 10:22:33 +04:00
user qemu: Declare all load/store helper in 'qemu/bswap.h' 2025-07-15 02:56:39 -04:00
elf.h
glib-compat.h include/glib-compat.h: Poison g_list_sort and g_slist_sort 2025-05-06 16:02:04 +02:00
qemu-io.h
qemu-main.h ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00