Re: [RFC PATCH v2 1/8] crypto: Allow gracefully ending the TLS session
On Fri, Feb 07, 2025 at 02:55:57PM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On Fri, Feb 07, 2025 at 11:27:51AM -0300, Fabiano Rosas wrote: > >> QEMU's TLS session code provides no way to call gnutls_bye() to > >> terminate a TLS session. Callers of qcrypto_tls_session_read() can > >> choose to ignore a GNUTLS_E_PREMATURE_TERMINATION error by setting the > >> gracefulTermination argument. > >> > >> The QIOChannelTLS ignores the premature termination error whenever > >> shutdown() has already been issued. This is not enough anymore for the > >> migration code due to changes [1] in the synchronization between > >> migration source and destination. > > > > This sentence seems to say commit [1] changed something on the tls > > condition, but IMHO fundamentally the issue is multifd recv thread model > > that relies on blocking readv() rather than request-based (like what src > > multifd does). > > > > Now src uses either shutdown() or close() to kick dest multifd recv threads > > out from readv(). That has nothing to do with what we do during complete() > > with those sync messages.. referencing it is ok, but we'll need to > > reference also the other commit to be clear pre-9.0 can also be prone to > > this. To me, it's more important to mention the root cause on the multifd > > recv thread model, which requires explicit tls terminations. > > > > I didn't want to go into too much detail in a commit for crypto/. The You already did so by referencing a multifd commit that changes how complete() works! > motivation for *this* patch is just: migration needs it. What about: > > The QIOChannelTLS ignores the premature termination error whenever > shutdown() has already been issued. This was found to be not enough for > the migration code because shutdown() might not have been issued before > the connection is terminated. Looks good to me, thanks. -- Peter Xu
Re: [RFC PATCH v2 1/8] crypto: Allow gracefully ending the TLS session
Peter Xu writes:
> On Fri, Feb 07, 2025 at 11:27:51AM -0300, Fabiano Rosas wrote:
>> QEMU's TLS session code provides no way to call gnutls_bye() to
>> terminate a TLS session. Callers of qcrypto_tls_session_read() can
>> choose to ignore a GNUTLS_E_PREMATURE_TERMINATION error by setting the
>> gracefulTermination argument.
>>
>> The QIOChannelTLS ignores the premature termination error whenever
>> shutdown() has already been issued. This is not enough anymore for the
>> migration code due to changes [1] in the synchronization between
>> migration source and destination.
>
> This sentence seems to say commit [1] changed something on the tls
> condition, but IMHO fundamentally the issue is multifd recv thread model
> that relies on blocking readv() rather than request-based (like what src
> multifd does).
>
> Now src uses either shutdown() or close() to kick dest multifd recv threads
> out from readv(). That has nothing to do with what we do during complete()
> with those sync messages.. referencing it is ok, but we'll need to
> reference also the other commit to be clear pre-9.0 can also be prone to
> this. To me, it's more important to mention the root cause on the multifd
> recv thread model, which requires explicit tls terminations.
>
I didn't want to go into too much detail in a commit for crypto/. The
motivation for *this* patch is just: migration needs it. What about:
The QIOChannelTLS ignores the premature termination error whenever
shutdown() has already been issued. This was found to be not enough for
the migration code because shutdown() might not have been issued before
the connection is terminated.
>>
>> Add support for calling gnutls_bye() in the tlssession layer so users
>> of QIOChannelTLS can clearly identify the end of a TLS session.
>>
>> 1- 1d457daf86 ("migration/multifd: Further remove the SYNC on complete")
>>
>> Signed-off-by: Fabiano Rosas
Re: [RFC PATCH v2 1/8] crypto: Allow gracefully ending the TLS session
On Fri, Feb 07, 2025 at 11:27:51AM -0300, Fabiano Rosas wrote:
> QEMU's TLS session code provides no way to call gnutls_bye() to
> terminate a TLS session. Callers of qcrypto_tls_session_read() can
> choose to ignore a GNUTLS_E_PREMATURE_TERMINATION error by setting the
> gracefulTermination argument.
>
> The QIOChannelTLS ignores the premature termination error whenever
> shutdown() has already been issued. This is not enough anymore for the
> migration code due to changes [1] in the synchronization between
> migration source and destination.
This sentence seems to say commit [1] changed something on the tls
condition, but IMHO fundamentally the issue is multifd recv thread model
that relies on blocking readv() rather than request-based (like what src
multifd does).
Now src uses either shutdown() or close() to kick dest multifd recv threads
out from readv(). That has nothing to do with what we do during complete()
with those sync messages.. referencing it is ok, but we'll need to
reference also the other commit to be clear pre-9.0 can also be prone to
this. To me, it's more important to mention the root cause on the multifd
recv thread model, which requires explicit tls terminations.
>
> Add support for calling gnutls_bye() in the tlssession layer so users
> of QIOChannelTLS can clearly identify the end of a TLS session.
>
> 1- 1d457daf86 ("migration/multifd: Further remove the SYNC on complete")
>
> Signed-off-by: Fabiano Rosas
--
Peter Xu
Re: [RFC PATCH v2 1/8] crypto: Allow gracefully ending the TLS session
On Fri, Feb 07, 2025 at 11:27:51AM -0300, Fabiano Rosas wrote:
> QEMU's TLS session code provides no way to call gnutls_bye() to
> terminate a TLS session. Callers of qcrypto_tls_session_read() can
> choose to ignore a GNUTLS_E_PREMATURE_TERMINATION error by setting the
> gracefulTermination argument.
>
> The QIOChannelTLS ignores the premature termination error whenever
> shutdown() has already been issued. This is not enough anymore for the
> migration code due to changes [1] in the synchronization between
> migration source and destination.
>
> Add support for calling gnutls_bye() in the tlssession layer so users
> of QIOChannelTLS can clearly identify the end of a TLS session.
>
> 1- 1d457daf86 ("migration/multifd: Further remove the SYNC on complete")
Would be slightly clearer as "[1] 1d457daf86 "
>
> Signed-off-by: Fabiano Rosas
> ---
> crypto/tlssession.c | 41 +
> include/crypto/tlssession.h | 22
> 2 files changed, 63 insertions(+)
Reviewed-by: Daniel P. Berrangé
Acked-by: Daniel P. Berrangé
With regards,
Daniel
--
|: https://berrange.com -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
