]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ktls: Fix accounting for TLS 1.0 empty fragments.
authorJohn Baldwin <jhb@FreeBSD.org>
Mon, 16 Aug 2021 17:42:46 +0000 (10:42 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Mon, 16 Aug 2021 17:42:46 +0000 (10:42 -0700)
commitd16cb228c1a62a9641ffb2f0bfcacc3bffec5db1
treebe48054376cb248f5f03d9030c200ed88d3a9ccc
parent69e8e8ea3d4be9da6b5bc904a444b51958128ff5
ktls: Fix accounting for TLS 1.0 empty fragments.

TLS 1.0 empty fragment mbufs have no payload and thus m_epg_npgs is
zero.  However, these mbufs need to occupy a "unit" of space for the
purposes of M_NOTREADY tracking similar to regular mbufs.  Previously
this was done for the page count returned from ktls_frame() and passed
to ktls_enqueue() as well as the page count passed to pru_ready().

However, sbready() and mb_free_notready() only use m_epg_nrdy to
determine the number of "units" of space in an M_EXT mbuf, so when a
TLS 1.0 fragment was marked ready it would mark one unit of the next
mbuf in the socket buffer as ready as well.  To fix, set m_epg_nrdy to
1 for empty fragments.  This actually simplifies the code as now only
ktls_frame() has to handle TLS 1.0 fragments explicitly and the rest
of the KTLS functions can just use m_epg_nrdy.

Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31536
sys/kern/uipc_ktls.c