lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <5e04afe0-7bf3-1bdf-f4f1-49b0c7bb5dba@grimberg.me> Date: Mon, 7 Aug 2023 10:08:50 +0300 From: Sagi Grimberg <sagi@...mberg.me> To: Jakub Kicinski <kuba@...nel.org>, Hannes Reinecke <hare@...e.de> Cc: Christoph Hellwig <hch@....de>, Keith Busch <kbusch@...nel.org>, linux-nvme@...ts.infradead.org, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org Subject: Re: [PATCH] net/tls: avoid TCP window full during ->read_sock() >> When flushing the backlog after decoding each record in ->read_sock() >> we may end up with really long records, causing a TCP window full as >> the TCP window would only be increased again after we process the >> record. So we should rather process the record first to allow the >> TCP window to be increased again before flushing the backlog. > >> - released = tls_read_flush_backlog(sk, prot, rxm->full_len, to_decrypt, >> - decrypted, &flushed_at); >> skb = darg.skb; >> + /* TLS 1.3 may have updated the length by more than overhead */ > >> + rxm = strp_msg(skb); >> + tlm = tls_msg(skb); >> decrypted += rxm->full_len; >> >> tls_rx_rec_done(ctx); >> @@ -2280,6 +2275,12 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc, >> goto read_sock_requeue; >> } >> copied += used; >> + /* >> + * flush backlog after processing the TLS record, otherwise we might >> + * end up with really large records and triggering a TCP window full. >> + */ >> + released = tls_read_flush_backlog(sk, prot, decrypted - copied, decrypted, >> + copied, &flushed_at); > > I'm surprised moving the flushing out makes a difference. > rx_list should generally hold at most 1 skb (16kB) unless something > is PEEKing the data. > > Looking at it closer I think the problem may be calling args to > tls_read_flush_backlog(). Since we don't know how much data > reader wants we can't sensibly evaluate the first condition, > so how would it work if instead of this patch we did: > > - released = tls_read_flush_backlog(sk, prot, rxm->full_len, to_decrypt, > + released = tls_read_flush_backlog(sk, prot, INT_MAX, 0, > decrypted, &flushed_at); > > That would give us a flush every 128k of data (or every record if > inq is shorter than 16kB). What happens if the window is smaller than 128K ? isn't that what Hannes is trying to solve for? Hannes, do you have some absolute numbers to how the window behaves?
Powered by blists - more mailing lists