🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.bugs
Article #790

[Bug 301183] rack: rack_setup_offset_for_rsm() counts the SYN byte, so split TFO maps crash clients on 15.1, 14.5 and 14.4

#790
From: bugzilla-noreply
Date: Fri, 27 Nov 2026 12:24
101 lines
6028 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301183

            Bug ID: 301183
           Summary: rack: rack_setup_offset_for_rsm() counts the SYN byte,
                    so split TFO maps crash clients on 15.1, 14.5 and 14.4
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: laamalif@proton.me

The RACK stack counts the SYN flag as a socket-buffer
byte when it computes the mbuf offset for the right-hand
piece of a split send map, so a TCP Fast Open client
crashes when a server splits the map holding its SYN and
data. The fix, ff066579fd77 (PR 297006, D61149), landed on
main on November 7, was cherry-picked to stable/15 and
releng/15.2, but not to the supported releases below.

rack_log_output() records a TFO SYN carrying data as one
send map covering the SYN byte plus the payload (releng/15.1
bb03631fe3b7, rack.c:8182-8185 and 8233-8238). A reply
forcing a split of that map makes rack_clone_rsm() keep
RACK_HAS_SYN on the left piece and call
rack_setup_offset_for_rsm(), which unfixed computes

        soff = src_rsm->soff + (src_rsm->r_end - src_rsm->r_start);

at rack.c:6841. The SYN byte has no socket-buffer counterpart,
so the walk at 6842 runs one byte past the payload. With a
one-byte TFO payload the walk exits the last mbuf and the
KASSERT at 6846 is compiled out on GENERIC; the re-derivation
stores the NULL sbsndmbuf() returns at 6851-6853; the
m->m_len read at 6854 faults first. The fix skips the SYN
byte when RACK_HAS_SYN is set.

The function is byte-identical on releng/15.1 (bb03631fe3b7,
rack.c:6829-6868), 14.5, 14.4 and stable/14, and the
ff066579fd77 diff applies cleanly to each.

I reproduced the crash with tfo_split_peer.c, attached. It
scripts the server side on a tap(4) interface: the first
connection primes the client's TFO cookie cache, the second
sends one byte inside the SYN and receives the
bare-SYN-with-data reply from the packetdrill script in
PR 297006. On 15.1-RELEASE-p6 GENERIC arm64
(releng/15.1-n283643-95719d8a895b) with tcp_rack loaded,
five runs rebooted the box within seconds of the scripted
reply; SSH died before the program printed anything:
last shows the boots:

boot time                                  Thu Nov 26 23:28
boot time                                  Thu Nov 26 23:03
boot time                                  Thu Nov 26 22:59
boot time                                  Thu Nov 26 22:54
boot time                                  Thu Nov 26 22:45

The same program rebooted the June 29 16.0-CURRENT
GENERIC amd64 build (main-n287061-65251c43415a, pre-fix)
mid-run at 19:07, no panic text captured either.

The reproducer builds and runs as:

cc -Wall -Wextra -Werror -o tfo_split_peer tfo_split_peer.c
./tfo_split_peer

On the fixed kernel, a GENERIC-KASAN build of the
November 22 main tip (main-6edecf52def6), four runs
printed the control then completed the exchange:

CONTROL-OK
trigger: SYN seq=1751611167 with 1 data byte (valid cookie)
trigger: post-bare-SYN frame flags 0x02 seq 1751611168 ack 0 data 0
SPLIT-NO-CRASH

An earlier build with a no-data trigger variant left the
connection silent and never called rack_clone_rsm() under
dtrace; the attached program carries only the 42-byte
trigger. The panic text went to the serial console these
VMs hold in the kernel, and neither accepts a crash dump,
so I have no trap frame; the CURRENT panic messages are
in PR 297006. The fix
needs no new code: please MFC ff066579fd77 to releng/15.1,
14.5 and 14.4. I have not run the trigger on 14.5, 14.4 or stable/14,
and I have not built or booted the attached fix on 15.1;
the fixed-kernel runs were on 16.0-CURRENT, not a
supported release.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-301183-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 301183] rack: rack_setup_offset_for_rsm() counts the SYN byte,
 so split TFO maps crash clients on 15.1, 14.5 and 14.4
Date: Fri, 27 Nov 2026 12:24:24 +0000
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-301183-227@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="48768"; mail-complaints-to="news-admin@muc.de"
X-Original-To: bugs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1795782264;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=g1dv5AGaiz0kgf2SUOX/JlADQEw7xs9A4nAWDZ6uDFI=;
	b=SZv85bWWlCmRXaxEkQjDxrN9l6UCt548H9sBl3+XSSpAbUlapmM3wNehs/oh0Qe4tkN8oF
	VE0F1YLIEgqXt3WxRLvfgDRfJN0uoJwSissNy7BZqTgofpFPSJxUqexI+A9y1uKfSdhDrS
	wPTp9bjQxIuX+cF6UfCxcO6H7gatrjfKLM5ql+FjVhoEs6UG+aMSX9o7mkdt6gNQtB5Lsl
	rhbCYtvXmLvXl/P0c/cMvxxTW/YsLbehR51NpX5Uuvqe6kOV9Ib7IYVb3s0Xpi3+JeufDL
	mOU+lSEY4AKRuHwbM7ybCck/7EkBQhvFy2hezL16+xitXcGUXX5oUwEsMuG6eQ==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes