untrusted comment: verify with openbsd-80-base.pub RWSMSt0erHTcteqbfRqwb7zbp6N4Qrme6h7Rjd5IUbNo6nTdD1q8ZPHslZ39w2ZDGjYL5eqO/sccyMbhEZOcpWln/HMNcSMkrQs= OpenBSD 8.0 errata 028, December 3, 2026: TCP did not limit the length of the reassembly queue per connection. Restrict its size for incoming segments. Apply by doing: signify -Vep /etc/signify/openbsd-80-base.pub -x 028_tcpqlen.patch.sig \ -m - | (cd /usr/src && patch -p0) And then rebuild and install a new kernel: KK=`sysctl -n kern.osversion | cut -d# -f1` cd /usr/src/sys/arch/`machine`/compile/$KK make obj make config make make install Index: sys/netinet/tcp_input.c =================================================================== RCS file: /cvs/src/sys/netinet/tcp_input.c,v diff -u -p -r1.469.2.1 tcp_input.c --- sys/netinet/tcp_input.c 10 Nov 2026 21:52:27 -0000 1.469.2.1 +++ sys/netinet/tcp_input.c 26 Nov 2026 17:04:02 -0000 @@ -158,6 +158,8 @@ do { \ if_put(ifp); \ } while (0) +#define TCP_REASS_MAXQLEN 100 /* Max # segments per reassembly queue */ + int tcp_input_solocked(struct mbuf **, int *, int, int, struct socket **); int tcp_mss_adv(struct rtentry *, int); int tcp_flush_queue(struct tcpcb *); @@ -195,7 +197,19 @@ struct syn_cache *syn_cache_lookup(const int tcp_reass(struct tcpcb *tp, struct tcphdr *th, struct mbuf *m, int *tlen) { + struct socket *so = tp->t_inpcb->inp_socket; struct tcpqent *p, *q, *nq, *tiqe; + u_int qlimit; + + /* Room for a full window of segments of at least 1 KB. */ + qlimit = max(TCP_REASS_MAXQLEN, READ_ONCE(so->so_rcv.sb_hiwat) / 1024); + + /* Bound the linear search through a per-connection queue. */ + if (tp->t_segqlen >= qlimit && th->th_seq != tp->rcv_nxt) { + tcpstat_inc(tcps_rcvmemdrop); + m_freem(m); + return (-1); + } /* * Allocate a new queue entry, before we throw away any data. @@ -211,6 +225,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd /* Reuse last entry since new segment fills a hole */ m_freem(tiqe->tcpqe_m); TAILQ_REMOVE(&tp->t_segq, tiqe, tcpqe_q); + tp->t_segqlen--; } if (tiqe == NULL || th->th_seq != tp->rcv_nxt) { /* Flush segment queue for this connection */ @@ -275,6 +290,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = TAILQ_NEXT(q, tcpqe_q); m_freem(q->tcpqe_m); TAILQ_REMOVE(&tp->t_segq, q, tcpqe_q); + tp->t_segqlen--; pool_put(&tcpqe_pool, q); } @@ -287,6 +303,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd } else { TAILQ_INSERT_AFTER(&tp->t_segq, p, tiqe, tcpqe_q); } + tp->t_segqlen++; if (th->th_seq != tp->rcv_nxt) return (0); @@ -318,6 +335,7 @@ tcp_flush_queue(struct tcpcb *tp) nq = TAILQ_NEXT(q, tcpqe_q); TAILQ_REMOVE(&tp->t_segq, q, tcpqe_q); + tp->t_segqlen--; if (so->so_rcv.sb_state & SS_CANTRCVMORE) m_freem(q->tcpqe_m); else { Index: sys/netinet/tcp_subr.c =================================================================== RCS file: /cvs/src/sys/netinet/tcp_subr.c,v diff -u -p -r1.216 tcp_subr.c --- sys/netinet/tcp_subr.c 18 Jul 2025 08:39:14 -0000 1.216 +++ sys/netinet/tcp_subr.c 26 Nov 2026 17:04:02 -0000 @@ -543,6 +543,7 @@ tcp_freeq(struct tcpcb *tp) pool_put(&tcpqe_pool, qe); rv = 1; } + tp->t_segqlen = 0; return (rv); } Index: sys/netinet/tcp_var.h =================================================================== RCS file: /cvs/src/sys/netinet/tcp_var.h,v diff -u -p -r1.196 tcp_var.h --- sys/netinet/tcp_var.h 16 Sep 2025 17:29:35 -0000 1.196 +++ sys/netinet/tcp_var.h 26 Nov 2026 17:04:03 -0000 @@ -203,6 +203,8 @@ struct tcpcb { u_int t_rcvoopack; /* out-of-order packets received */ u_int t_sndrexmitpack; /* retransmit packets sent */ u_int t_sndzerowin; /* zero-window updates sent */ + + u_int t_segqlen; /* segment count in sequencing queue */ }; #define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb)