Date: Tue, 7 Jun 2022 07:40:38 GMT From: Richard Scheffenegger <rscheff@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 91d6afe6e2a9 - main - tcp: Sanity check of SACK holes on retransmissions Message-ID: <202206070740.2577ecdd074466@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=91d6afe6e2a912fd5059fc11dbeffc85474897af commit 91d6afe6e2a912fd5059fc11dbeffc85474897af Author: Richard Scheffenegger <rscheff@FreeBSD.org> AuthorDate: 2022-06-07 07:07:09 +0000 Commit: Richard Scheffenegger <rscheff@FreeBSD.org> CommitDate: 2022-06-07 07:38:16 +0000 tcp: Sanity check of SACK holes on retransmissions Adding a few KASSERT() to validate sanity of sack holes, and bail out if sack hole is inconsistent to avoid panicing non-invariant builds. Reviewed By: hselasky, glebius PR: 263445 MFC after: 1 week Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D35387 --- sys/netinet/tcp_sack.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index c38b9dd1d006..c1bbf65a0770 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -965,6 +965,18 @@ tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt) } } out: + KASSERT(SEQ_LT(hole->start, hole->end), ("%s: hole.start >= hole.end", __func__)); + KASSERT(SEQ_LT(hole->start, tp->snd_fack), ("%s: hole.start >= snd.fack", __func__)); + KASSERT(SEQ_LT(hole->end, tp->snd_fack), ("%s: hole.end >= snd.fack", __func__)); + KASSERT(SEQ_LT(hole->rxmit, tp->snd_fack), ("%s: hole.rxmit >= snd.fack", __func__)); + if (SEQ_GEQ(hole->start, hole->end) || + SEQ_GEQ(hole->start, tp->snd_fack) || + SEQ_GEQ(hole->end, tp->snd_fack) || + SEQ_GEQ(hole->rxmit, tp->snd_fack)) { + log(LOG_CRIT,"tcp: invalid SACK hole (%u-%u,%u) vs fwd ack %u, ignoring.\n", + hole->start, hole->end, hole->rxmit, tp->snd_fack); + return (NULL); + } return (hole); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206070740.2577ecdd074466>