mirror of https://gitlab.com/qemu-project/qemu
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
![]() QCryptoTLSSession allows TLS premature termination in two cases, one of the case is when the channel shutdown() is invoked on READ side. It's possible the shutdown() happened after the read thread blocked at gnutls_record_recv(). In this case, we should allow the premature termination to happen. The problem is by the time qcrypto_tls_session_read() was invoked, tioc->shutdown may not have been set, so this may instead be treated as an error if there is concurrent shutdown() calls. To allow the flag to reflect the latest status of tioc->shutdown, move the check upper into the QIOChannel level, so as to read the flag only after QEMU gets an GNUTLS_E_PREMATURE_TERMINATION. When at it, introduce qio_channel_tls_allow_premature_termination() helper to make the condition checks easier to read. When doing so, change the qatomic_load_acquire() to qatomic_read(): here we don't need any ordering of memory accesses, but reading a flag. qatomic_read() would suffice because it guarantees fetching from memory. Nothing else we should need to order on memory access. This patch will fix a qemu qtest warning when running the preempt tls test, reporting premature termination: QTEST_QEMU_BINARY=./qemu-system-x86_64 ./tests/qtest/migration-test --full -r /x86_64/migration/postcopy/preempt/tls/psk ... qemu-kvm: Cannot read from TLS channel: The TLS connection was non-properly terminated. ... In this specific case, the error was set by postcopy_preempt_thread, which normally will be concurrently shutdown()ed by the main thread. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juraj Marcin <jmarcin@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20250918203937.200833-2-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> |
3 weeks ago | |
---|---|---|
.. | ||
aes.c | 2 years ago | |
afalg.c | 1 year ago | |
afalgpriv.h | 1 year ago | |
afsplit.c | 1 year ago | |
akcipher-gcrypt.c.inc | 10 months ago | |
akcipher-nettle.c.inc | 10 months ago | |
akcipher.c | 1 year ago | |
akcipherpriv.h | 1 year ago | |
block-luks-priv.h | 3 years ago | |
block-luks.c | 1 year ago | |
block-luks.h | 6 years ago | |
block-qcow.c | 1 year ago | |
block-qcow.h | 6 years ago | |
block.c | 1 year ago | |
blockpriv.h | 1 year ago | |
cipher-afalg.c | 1 year ago | |
cipher-gcrypt.c.inc | 1 year ago | |
cipher-gnutls.c.inc | 1 year ago | |
cipher-nettle.c.inc | 1 year ago | |
cipher-stub.c.inc | 5 months ago | |
cipher.c | 5 months ago | |
cipherpriv.h | 1 year ago | |
clmul.c | 2 years ago | |
der.c | 1 year ago | |
der.h | 1 year ago | |
hash-afalg.c | 8 months ago | |
hash-gcrypt.c | 12 months ago | |
hash-glib.c | 1 year ago | |
hash-gnutls.c | 1 year ago | |
hash-nettle.c | 12 months ago | |
hash.c | 12 months ago | |
hashpriv.h | 1 year ago | |
hmac-gcrypt.c | 2 months ago | |
hmac-glib.c | 2 months ago | |
hmac-gnutls.c | 2 months ago | |
hmac-nettle.c | 2 months ago | |
hmac.c | 1 year ago | |
hmacpriv.h | 1 year ago | |
init.c | 1 year ago | |
ivgen-essiv.c | 6 years ago | |
ivgen-essiv.h | 6 years ago | |
ivgen-plain.c | 6 years ago | |
ivgen-plain.h | 4 years ago | |
ivgen-plain64.c | 6 years ago | |
ivgen-plain64.h | 6 years ago | |
ivgen.c | 1 year ago | |
ivgenpriv.h | 1 year ago | |
meson.build | 1 year ago | |
pbkdf-gcrypt.c | 12 months ago | |
pbkdf-gnutls.c | 1 year ago | |
pbkdf-nettle.c | 12 months ago | |
pbkdf-stub.c | 1 year ago | |
pbkdf.c | 9 months ago | |
random-gcrypt.c | 6 years ago | |
random-gnutls.c | 6 years ago | |
random-none.c | 5 years ago | |
random-platform.c | 6 years ago | |
rsakey-builtin.c.inc | 1 year ago | |
rsakey-nettle.c.inc | 1 year ago | |
rsakey.c | 3 years ago | |
rsakey.h | 3 years ago | |
secret.c | 6 months ago | |
secret_common.c | 6 months ago | |
secret_keyring.c | 6 months ago | |
sm4.c | 2 years ago | |
tls-cipher-suites.c | 6 months ago | |
tlscreds.c | 6 months ago | |
tlscredsanon.c | 6 months ago | |
tlscredspriv.h | 4 years ago | |
tlscredspsk.c | 6 months ago | |
tlscredsx509.c | 3 months ago | |
tlssession.c | 3 weeks ago | |
trace-events | 3 months ago | |
trace.h | 5 years ago | |
x509-utils.c | 3 months ago | |
xts.c | 6 years ago |